Zlatan Ibrahimovic had put the Rossoneri ahead with a goal in the first half, but following his sending off for two bookable offenses, the Nerrazurri got the edge.
Romelu Lukaku restored parity from the spot after Nicolo Barella was fouled inside the area by Rafael Leao. Substitute Christian Eriksen settled the contest with a sublime free-kick, eight minutes into stoppage time.
The match also witnessed former Manchester United teammates Lukaku and Ibrahimovic embroiled in heated exchanges.
Whereas the referee, in a rare sight, went off injured midway through the second half.
Here are the hit and flop performers from a riveting Derby della Madonnina encounter:
Hit: Zlatan Ibrahimovic (AC Milan)
Another big game, another big goal, from the big man himself - Ibrahimovic stepped up once again and scored for the 10th time against Inter Milan in his career.
Receiving a delicious cross from Soualiho Meite, the Swede took a few touches to set himself up and blazed a cross-body shot into bottom corner for his 14th strike of the season.
That's an impressive number for a 39-year-old as Ibrahimovic continues to defy Father Time with his blistering scoring exploits.
He obviously marred the game by pelting choicest of insults at Lukaku and then getting sent off. But actually, the contact for that foul was minimal, and it was rather harsh from the referee.
Flop: Paolo Valeri (Referee)
Talking of the referee, well, he had an absolute stinker. Hence we make the odd choice of picking him here instead of a player.
Firstly, going back to that Ibrahimovic incident. The referee got a clear view of it and decided to send him off, despite the contact being minimal.
Secondly, the penalty was controversial as Leao's challenge on Barella was soft, even though the midfielder went down convincingly enough.
These two decisions eventually proved decisive as Inter made the most of it. But they'll be discussed even long after the full-time whistle.
Valeri didn't have the best night in terms of officiating, but worse was yet to come - he limped off the field after an apparent injury in the 75th minute and was replaced by a fourth official!
Quite extra-ordinary scenes.