Defender Cristian Zapata was Milan's unlikely hero when he managed to force the ball over the line at the far post in the seventh minute of stoppage time after Inter failed to clear a corner.
The Colombia defender hooked the ball against the underside of the crossbar and, although Gary Medel cleared it off the line, the referee immediately awarded the goal, helped by goalline technology.
Zapata's fellow defender Alessio Romagnoli began the fightback seven minutes from time when he turned in Suso's cross.
Inter, who appeared to have been time-wasting, could have sealed the game seconds before Zapata's goal when substitute Jonathan Biabiany fired over the bar when it seemed to easier score.
"We never gave up. Anyone who wears this shirt always fights until the end," Zapata said. "Were they time-wasting? That's normal when you're 2-0 ahead."
The match was played less than 48 hours after Milan were sold to a Chinese-led consortium in a 740 million-euro ($788 million) deal, following in the footsteps of Inter who have been owned by retail giant Suning Commerce Group since June.
The lunchtime kickoff, the first in 218 meetings of the old rivals, was designed for the Asian television market, though criticised by local fans. Media reports predicted a potential worldwide television audience of 862 million viewers.
Milan, who had created enough chances to have led by then, found themselves two behind when Mauro Icardi turned in Ivan Perisic's low cross one minute before halftime for his 21st goal of the season.