(CNN) -- Milan legend Paolo Maldini played his final match in front of his San Siro fans on Sunday, but Roma spoiled the celebrations by claiming a shock 3-2 defeat.
Maldini salutes the crowd on his lap of honor as his San Siro career ends in a 3-2 defeat by Roma.
The 40-year-old Maldini made his debut for the club in 1985 as a 16-year-old and he was awarded an emotional lap of honor despite the match result.
Roma took a first-half lead when Norwegian defender lashed home a fierce shot after David Pizarro rolled a free-kick into his path -- and the scoreline remained the same until an explosive final 15 minutes.
Milan levelled in the 75th minute when Roma goalkeeper Artur saved Filippo Inzaghi's shot from Kaka's cross -- and Massimo Ambrosini swept home the loose ball.
But just five minutes later Roma were back in front as Jeremy Menez twisted and turned in the area before shooting across Dida into the far corner.
That lead lasted only a minute as Ambrosini was left unmarked at the back post to turn home Kaka's cross for his second of the game.
But Roma came back again and they took the lead for the third time when captain Francesco Totti thumped home a free-kick with five minutes to play.
Milan and Juventus are now level on points in second position, but Juve lead on their head-to head after a 3-0 victory at Siena, their first win in eight matches.
Both teams are guaranteed Champions League football and are 10 points behind champions Inter Milan with just one match remaining, despite Jose Mourinho's side going down 2-1 at Cagliari.
Meanwhile, a last-minute Martin Jorgensen goal earned fourth-placed Fiorentina, who will go into the Champions League qualifiers, a 1-1 draw at Lecce -- a result that relegates the home side to Serie B.
Lecce join already relegated Reggina in the second tier. They will be joined by either Bologna, who drew 0-0 against Chievo, or Torino -- who lost 3-2 against Genoa -- in losing their top flight status.