(CNN) -- AC Milan have moved up to second place in the Italian Serie A table, just four points behind city rivals Inter, after Brazilian international Alexandre Pato scored a last-gasp winner to give them a 2-1 victory at Fiorentina.
Pato fired home Ronaldinho's cross in the final minute to ensure the Rossoneri moved above Roma in the title race.
Fiorentina opened the scoring in the 14th minute when former AC Milan striker Alberto Gilardino tapped-home after Milan had not dealt properly with Stevan Jovetic's pass.
But substitute Klass-Jan Huntelaar levelled with 10 minutes remaining, after a superb one-two with Ronaldinho, before Pato won it for Milan at the death.
Meanwhile, in the evening's other Serie A match, Udinese fought back to claim a hard-fought 2-1 home win over Cagliari.
Brazilian striker Jeda headed Cagliari into a third-minute lead but two goals in as many second-half minutes from Alexis Sanchez and top scorer Antonio Di Natale marked coach Pasquale Marino's return to the club with a victory.