Cristiano Ronaldo scored a double to overturn Bayern Munich
A Cristiano Ronaldo double cancelled out Arturo Vidal’s opener – with both goals coming after the Chile midfielder had also missed a penalty.
Javi Martinez was shown a red card in between Ronaldo’s goals.
Vidal opened the scoring after 25 minutes and seemed to put the hosts in control.
Cristiano Ronaldo scored twice to pull Real Madrid out of a mess
Arturo Vidal scored the opener for Bayern Munich
But Ronaldo had other ideas and grabbed two second half goals after Manuel Neuer appeared to have salvaged a draw with a string of saves.
Bayern, who had thrashed English club Arsenal 10-2 on aggregate to take their place in the last eight, went in front after 26 minutes through a bullet header from Vidal.
The Chile midfielder, though, wasted a chance to double the German club's advantage in first-half stoppage time when he blasted a penalty over the crossbar after what looked a poor handball decision against Dani Carvajal.
Real were level two minutes into the second half when Ronaldo swept in a cross from Carvajal.
Real Madrid wages revealed: Which stars earn most? Fri, March 24, 2017
Click to reveal every Real Madrid player's weekly wages, according to Totalsportek.com
Play slideshow GETTY 1 of 25
Get Quotes on Home Insurance
Click to reveal every Real Madrid player's weekly wages
Bayern had to play the final 30 minutes a man down after Martinez picked up two quick cautions.
And Ronaldo took his tally to 100 European goals when he stabbed the ball past Neuer in the 77th minute to leave Carlo Ancelotti's men with it all to do in next week's second leg back at the Bernabeu.
Bayern were missing Poland forward Robert Lewandowsi because of a shoulder injury, so Thomas Muller lead the attack.
Real, unbeaten so far in the Champions League this season, had to do without defenders Raphael Varane and Pepe, who suffered a double rib fracture in Saturday's 1-1 draw with city rivals Atletico.