The Argentinian pounced on a mistake by goalkeeper Gianluigi Donnarumma to nod home in the second minute of added time after an otherwise forgettable match, leaving Gennaro Gattuso’s Milan without a win in the last five league derbies.
But Luciano Spalletti’s Inter continued their recent resurgence after finishing fourth last term to qualify for the Champions League for the first time since 2011-12, moving to within six points of leaders Juventus, after their 1-1 home draw with Genoa on Saturday.
AC Milan remain down in 12th after seeing their eight-game unbeaten run in all competitions ended.
Icardi had the ball in the net early on, but the striker’s effort was ruled out for offside after a check with VAR.
Although the opening stages of the game were not overflowing with attacking quality, there was plenty of niggle, with Milan midfielder Lucas Biglia left incensed after he was booked despite appearing to have been stamped on by Radja Nainggolan.
It was the former Roma man who had to be substituted, though, as he hobbled off to be replaced by Borja Valero.
Nominal home side Inter looked the more likely to find a breakthrough in the first half, with Ivan Perisic seeing a header palmed away by Donnarumma and Stefan de Vrij striking the crossbar with a twisting volley.
Out of nowhere AC Milan thought they had taken the lead shortly before half-time, but it was Mateo Musacchio’s turn to be denied by the linesman’s flag.
Inter had a couple of second-half chances from set-pieces, with Matias Vecino nodding over and Perisic seeing a thunderous strike blocked.
The game appeared to be petering out into a goalless draw, but Donnaruma came and failed to claim a speculative right-wing cross from Vecino, and Icardi headed into the unguarded net to score his fourth league goal of the campaign and spark jubilant scenes among the Inter fans in the stands.
– Lazio into top four –
Earlier on Sunday, late goals from Ciro Immobile and Joaquin Correa gave Lazio a 2-0 win at Parma.
Promoted in each of the three seasons since their bankruptcy, Parma have impressed this season but their late capitulation saw the visiting Roman outfit into the top four.
Ex-Italy boss Gian Piero Ventura returned to coaching but failed to guide tailenders Chievo to their first win of the season.
Relegation rivals Atalanta ripped Chievo apart in a 5-1 home mauling for Ventura in his first game since being sacked last November after Italy failed to reach the World Cup finals for the first time since 1958.
Two other clubs also locked in the relegation zone shared the points as Frosinone and Empoli drew 3-3 in a game where Frosinone doubled their season’s goals tally to six and their points tally to two.
For more news your way, download The Citizen’s app for iOS and Android.
Download our app and read this and other great stories on the move. Available for Android and iOS.