Inter started in third but leapfrogged Lazio and head the table on goal difference from champions Juventus.
Ante Rebic tapped home from Zlatan Ibrahimovic’s knockdown and the Swede headed in the second before the break.
But Marcelo Brozovic volleyed in and Matias Vecino stroked home Alexis Sanchez’s cutback before Stefan de Vrij and Romelu Lukaku both scored headers.
Antonio Conte’s side looked beaten at half-time after a lethargic opening 45 minutes, but responded in sensational fashion in the second period with four unanswered goals.
Both sides hit the woodwork in a thrilling derby, Hakan Calhanoglu smashing the post with a low drive and Ibrahimovic heading against the post late on, while Inter’s January signing Christian Eriksen rattled the crossbar with a long-range free-kick.
Milan had been in good form under coach Stefano Pioli, losing just one of their previous 11 league games under the former Inter boss, but their second-half capitulation keeps them in 10th place.Report
Inter are now unbeaten in 16 league games and host Napoli on Wednesday, before a crucial clash against fellow title challengers Lazio next Sunday.
“It’s still very early to talk about something we can only dream of for now,” Conte told Sky Italia.
“We can have a dream. It’s a very intense period for us coming up and after that we’ll have a better idea of our potential and our real capabilities.
“We can’t achieve everything from one day to the next, but we are building. These guys proved they have great strength and guts today.”
Earlier on Sunday, Simone Inzaghi’s Lazio side showed their credentials by extending their unbeaten run to 18 games with a narrow 1-0 win at Parma – former Manchester City striker Felipe Caicedo scoring the winner.