A controversial last-minute penalty ensured Real Madrid qualified for the semi-finals of the UEFA champions league at the expense of Juventus – only just.
The Spanish capital giants surrendered a 3-0 first leg lead from Turin, but Juventus took the game to the 2017 champions, and were in front by two goals before half-time.
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.
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.
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 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.
Buffon is set to leave Juventus at the end of the season.
Juve’s substitute goalkeeper Wojciech Szczesny came on but Ronaldo blasted into the top corner in the eighth minute of stoppage time to score for the 10th game running in this season’s competition.
The goal sent Real into the semi-finals for a record-extending eighth year in a row.
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.
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.
Raphael Varane also sent a header crashing against the bar from a free kick at the end of the half.
Real settled down after the interval, taming the visitors and twice firing at Buffon.
But down the other end Navas spilled 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.