Cristiano Ronaldo showed nerves of steel to score an injury-time penalty and send holders Real Madrid into the semi-finals of the Champions League in extraordinary circumstances as they lost 3-1 to Juventus on Wednesday but won a thrilling tie 4-3 on aggregate.
Juventus looked to have staged a stunning revival at the Santiago Bernabeu to force extra time after Mario Mandzukic scored twice in the first half and Blaise Matuidi added a third on the hour mark after a goalkeeping clanger from Real's Keylor Navas.
The goals cancelled out Real's resounding 3-0 win in Turin a week earlier but Lucas Vazquez won a disputed injury-time penalty and Juventus goalkeeper and captain Gianluigi Buffon was given a straight red card for pushing English referee Michael Oliver as he vented his fury at the decision.
The Italian veteran, who is set to leave Juventus at the end of the season, was given a standing ovation from the home fans as he walked off the pitch in what is likely to be his last act in a long and eventful career in the Champions League.
Juve's substitute goalkeeper Wojciech Szczesny came on but Ronaldo blasted into the top corner in the 98th minute to score for the 10th game running in this season's competition, sending Real into the semi-finals for a record-extending eighth year in a row.
"My pulse was racing but I stayed calm, I knew it was decisive," said Ronaldo.
"We suffered and this has to serve as a lesson for us that in football you can't take anything for granted, you have to keep fighting until the end."
Real were missing influential captain Sergio Ramos through suspension and Mandzukic headed Juventus in front when the game was only 76 seconds old, meeting a sumptuous cross from former Madrid midfielder Sami Khedira.
The early strike offered the visitors hope of repeating compatriots AS Roma's incredible second-leg turnaround against Barcelona the previous night and the Croatian struck again in the 37th minute, heading beyond Navas, who got a hand to the shot but could not prevent it going in.
Real had plenty of chances in the first half but Buffon made three strong saves to thwart Gareth Bale, Ronaldo and Isco, who was also denied a goal by the offside flag while Raphael Varane sent a header crashing against the bar from a free kick at the end of the half.
Bitter taste for Juve
Real settled down after the interval, taming the visitors and twice firing at Buffon but down the other end Navas spilt a cross from Douglas Costa right at the feet of Matuidi who rolled the ball in to level the tie.
Madrid soon woke up and produced their best spell of the game as Isco, Varane and Ronaldo all went close while Giorgio Chiellini narrowly avoided scoring an own goal.
Ronaldo finally got the vital goal they had craved to pile more misery on the Italians, who were beaten 4-1 by Madrid in last season's final in Cardiff.
"I have a bitter taste as we didn't have the chance to go to extra time," said Juventus coach Massimiliano Allegri.
"Small details changed the whole tie unfortunately. I had two more substitutions planned for extra time and I was confident we could do it."
In the days other game, Bayern Munich reached the Champions League semi-finals for the seventh time in nine seasons as Wednesday's goalless draw at home to Sevilla sent the German side through 2-1 on aggregate.
Real will be joined in Friday's draw for the last four by Liverpool, Roma, and Bayern Munich.
Bayern reached the Champions League semi-finals for the seventh time in nine seasons after a goalless draw at home to Sevilla on Wednesday sent the German side through 2-1 on aggregate.