Against expectations, AC Milan led 2-0 at half time, with goals from Ante Rebic and Zlatan Ibrahimovic.
Ibrahimovic, making his first Derby appearance since re-signing on a free transfer, headed down towards Rebic who tapped for the opener.
Just before the break, the Swedish star again made the difference, heading home after some sloppy defending from Inter to give the AC Milan a two-goal lead at the break.
Antonio Conte’s side surely knew what was at stake in Serie A. A victory would make his team draw level with Juventus at the summit.
It was a re-energised Inter that resumed play in the second half. Within six minutes of play, Marcelo Brozovic hammered home a volley to cut the deficit in half.
Just two minutes later, Inter were level with the visitors were level. Alexis Sanchez burst through the defence, cut it back to Matias Vecino and the midfielder struck home through the legs of Simon Kjaer.
With just 20 minutes to go, Stefan De Vrij headed home from an acute angle into the top corner, to give Inter the winner.
New signing Christian Eriksen came off the bench late on and nearly stole the headlines with an incredible 35-yard free-kick that smashed against the upright.
Victor Moses also made a late cameo from the bench and provided an assist for Inter’s fourth goal scored by Romelu Lukaku.