Jose Mourinho's side looked to be heading for defeat until the former Getafe wide man popped up with a vital goal.
Los Blancos had looked comfortable until the hour mark, with Gonzalo Higuain providing a deserved lead, but the arrival of evergreen Italian Pippo Inzaghi sparked the Rossoneri into an unlikely turnaround, finding the net on 68 and 78 minutes to leave the visitors positively stunned.
However, Pedro Leon drilled home Karim Benzema's intelligent through pass to earn what was a deserved point, and preserve Mourinho's unbeaten record at his new club, silencing the home crowd in the process.
The atmosphere was bristling even before kick-off, with Mourinho enjoying a playful exchange with the San Siro audience who booed his arrival in the dug-out, but once the match was underway it was his side who meant business.
The opening twenty minutes were dominated by the Spaniards, who created a number of clear-cut openings. Higuain’s low shot within 180 seconds stung the gloves of Christian Abbiati, then Angel Di Maria outpaced the static Milan backline, but upon cutting inside, could only drag his shot wide of the target.
Andrea Pirlo then made two stunning goal-line clearances, firstly from a looping header from the dangerous Higuain, then from Di Maria’s stinging volley.
Milan briefly rallied. Zlatan Ibrahimovic found himself well positioned twice, but Iker Casillas was sharp to block his first effort at the edge of the six yard area, before the Swede looped his lob woefully wide.
Real Madrid remained patient, however, and the lead was theirs on the stroke of half-time. Di Maria drove through the center, and slipped an intricate through pass to Higuain, who made no mistake, driving low past Abbiati and into the corner.
The second half began with Madrid seemingly content to rest on their one-goal advantage, and home coach Massimiliano Allegri knew that his set-up wasn’t working. The anonymous Ronaldinho was replaced by the veteran Pippo Inzaghi - and what an inspired change it was.
On 68 minutes, he used all of his poaching instincts to head home the leveller. Pepe’s error in judgment let Ibrahimovic break in from the left, and although his cross was poor, Iker Casillas inexplicably palmed the ball into the area, allowing the 37-year-old to head into the net inches from the line.
Ten minutes later, the Rossoneri were in dreamland, but had a slice of luck from the officials to seal a stunning reversal. A straightforward ball over the top found Inzaghi, standing in an offside position, but he ignored the pleas from the away defense to bundle the ball past Casillas, who once again was far from convincing.
Mourinho would have been apoplectic with the manner in which his team had capitulated. He threw on Karim Benzema in an attempt to save the match, and his French striker played a part in their dramatic equaliser in injury time.
Benzema's reverse pass found Pedro Leon in space, and he fired his shot under the body of Abbiati, to cue a dramatic touchline celebration from the elated Portuguese boss.
Milan will reflect on how close they were to a famous victory, while Mourinho's Midas touch means Real Madrid have qualified with two matches to spare.
Keep up to date with all the latest Champions League news with Goal.com and join Goal.com USA's Facebook fan page!