Captain Mauro Icardi scored a 90th-minute winner from a controversially awarded penalty to complete his hat-trick and give Inter victory in a thrilling Milan derby.
The Argentine kept his cool to slot home after Switzerland defender Ricardo Rodriguez was harshly adjudged to have fouled Danilo D'Ambrosio following a corner.
It capped a night of high drama as AC Milan twice came from behind to level and were moments away from securing a hard-earned point when the penalty was awarded.
While Inter move two points behind Serie A leaders Napoli, whom they meet next Saturday, AC Milan have lost their past three league games to fall 12 points behind their city rivals.
Antonio Candreva had already hit the bar for the hosts when Icardi got on the end of Candreva's delicious low cross to give his side the lead.
Former Liverpool player Suso equalised with a sublime 25-yard finish, but Inter restored their lead when Icardi, who now has nine goals in eight Serie A games this season, netted from close range.
AC Milan thought they had earned a point when Giacomo Bonaventura's sliding attempt trickled over the line off a post but Icardi's penalty settled a fascinating 219th Derby di Milano.