Watch: Gianluigi Buffon red-carded as Cristiano Ronaldo's late penalty ends Juventus' miraculous comeback
Gianluigi Buffon's glorious Champions League career ended in devastating circumstances after he was sent off in the final minute of an unforgettable night in the Bernabeu.
Juventus had scrapped their way back to level in the tie after they were beaten 3-0 in the first leg in Turin.
A first half brace from Mario Madzukic and Blaise Matuidi's second half goal looked to be sending the Champions League quarter-final into extra-time but English referee Michael Oliver awarded a late penalty for Medhi Benatia's clumsy tackle on Lucas Vasquez.
Buffon was livid with the Oliver's decision and was shown a straight red for his vociferous protestations.
Cristiano Ronaldo kept his cool to to slot the penalty passed Juve sub keeper Wojciech Szczesny and send Madrid through.
Real therefore win 4-3 on aggregate and join Liverpool, Roma and Bayern Munich - for whom a goalless draw with Sevilla at the Allianz Arena was enough - in the semi-final draw.
"It is a penalty. Benatia comes and makes contact before Vasquez plays the ball. He was on a yellow card. It should have been a red." Eamon Dunphy told RTE Sport.
Real Madrid were expected to cruise to the last four but Massimiliano Allegri's side had other ideas.
Croatian striker Mandzukic grabbed an away goal and a lifeline in the tie after just 90 seconds in the Spanish capital and the Juve frontman slashed the deficit to 3-2 on aggregate in the 37th minute.
Real's lead was completely cancelled out just before the hour mark as Blaise Matuidi capitalised on a howler from keeper Keylor Navas to cancel out the Spaniard's first leg advantage.
The game looked destined for 30 more minutes and possibly penalties until the late drama transpired.