Real Madrid advanced to the last four of the Champions League despite a 3-1 home defeat to Juventus at the Bernabeu on Wednesday (Thursday NZ time).
Bayern Munich meanwhile sealed their place in the semi-finals with a goalless draw at home to Sevilla, who had Joaquin Correa shown a red card in stoppage time.
Bayern and Real join Roma and Liverpool in Friday's semi-final draw.
German champions Bayern went through on a 2-1 aggregate after their first-leg victory in Spain last week for their sixth semi-final in the last seven years.
Real, 3-0 up from the first leg in Turin, found themselves down to two Mario Mandzukic headers in the first-half and conceded a third when Blaise Matuidi netted after the break following a fumble by keeper Keylor Navas.
However Real escaped extra-time and possibly one of the biggest upsets in Champions League history after a penalty was awarded when Mehdi Benatia fouled Lucas Vazquez in front of goal following Ronaldo's headed knock down in the third minute of stoppage time.
Goalkeeper Gianluigi Buffon was then shown a red card by English referee Michael Oliver amid vehement Juve protests in a sad Champions League farewell for the veteran keeper, who was playing his 160th match in UEFA competitions.
Poland keeper Wojciech Szczesny came on but couldn't stop Ronaldo's powerful shot into the top corner of the net before the Portugal raced to the corner flag while tearing off his shirt and pozing Tarzan-style before jubilant Madrid fans.
It was a 15th Champions League goal this season for Ronaldo, playing his 150th CL game, and he has now scored in 11 consecutive games in the competition.
Twelve-time European champions Real are now in the last four for the eighth season in a row.
Real, who had lost only one of their last 40 Champions League matches at home, went behind after 76 seconds when Mandzukic met Sami Khedira's cross to head powerfully in.
The Croatia striker headed a second at the far post in the 37th minute when substitute Stephan Lichtsteiner provided the cross from the right.
Real defender Raphael Varane headed a free-kick against the bar just before
half-time, but the home side was staring the possibility of a sensational exit after Matuidi made it three in the 61st minute.
It was the second unlikely comeback by an Italian side against a Spanish team in as many days following Roma's 3-0 defeat over Barcelona on Tuesday to go through on the away goals rule on a 4-4 aggregate.
DPA