Inter Milan's Mauro Icardi scored with two minutes remaining to hand them a 2-1 win over AS Roma in Serie A on Saturday, while AC Milan's slim hopes of playing in Europe next season were dented in a 2-1 defeat to Udinese.
Inter took a 15th-minute lead as Brazilian Hernanes was given too much space and drilled home a left-footed shot, but Roma levelled when Radja Nainggolan was teed up by Miralem Pjanic to fire in 18 minutes after the restart.
With both sides looking for the winner in the closing stages, it was the home side that came out on top.
Lukas Podolski kept possession before finding Icardi just outside the box. The Argentinian striker's low shot surprised Roma keeper Morgan De Sanctis for his 17th league goal of the season.
The result left second-place Roma on 58 points, level with Lazio, but crucially just five clear of Napoli in the battle to secure a top-three spot and a Champions League qualifying place.
Inter moved ahead of their city rivals into seventh on 45 points, four adrift of Fiorentina and the last Europa League spot.
The battle for a Champions League spot looks set to go to the wire with Lazio able to move clear in second place if they beat Chievo Verona on Sunday (1400 GMT), while fourth place Napoli can close in on Roma if they beat Sampdoria.
In the day's early kickoff, second-half goals by Giampiero Pinzi and Emmanuel Badu handed Udinese victory over AC Milan.
Milan are 10th with 43 points and six games to go. Udinese are 12th with 38 points from 32 games.