Champions League holders Real Madrid survived a huge scare as they were stunned 4-3 at home to German footballers Schalke 04.
But Real still squeezed through to the quarter-finals 5-4 on aggregate in the two-legged round of 16 tie.
A first-half Ronaldo double and a goal from Karim Benzema early in the second half saw Real through to the last eight but Schalke can consider themselves unlucky not to progress.
Striker Klaas-Jan Huntelaar scored twice for the visitors, including a late winner on the night, after Christian Fuchs has put the German side in front, with Leroy Sane also on target.
Up 2-0 after Real comfortably won last month's first leg in Gelsenkirchen, Schalke came out fighting at the Bernabeu and took a deserved lead in the 20th minute when Fuchs' shot ricocheted into the net off Real goalkeeper Iker Casillas.
Ronaldo levelled from a Toni Kroos corner five minutes later before former Real striker Huntelaar, who moments earlier had struck a fierce shot against the crossbar, put Schalke 2-1 ahead when he followed up Max Meyer's saved effort.
Ronaldo struck again from Fabio Coentrao's cross on the stroke of halftime - the Portugal captain's 75th Champions League goal putting him level at the top of the all-time scoring chart with Barcelona forward Lionel Messi.
Both sides continued to attack at every opportunity in the second half and Karim Benzema made it 3-2 in the 53rd minute before Schalke substitute Leroy Sane curled a shot past Casillas in the 57th to make it 3-3.
Huntelaar set up a nervous finish for the home fans when he smashed a brilliant effort in off the bar six minutes from time but Real held out to claim a place in the draw for the last eight on March the 20th.
In the day's other tie, Porto also reached the quarter-finals with a thumping and thoroughly deserved 4-0 home win over a flat Basel side that gave them a 5-1 aggregate success.
The Portuguese side took the lead with an excellent first-half free kick from Yacine Brahimi, which set the tone for an evening of superb long-range strikes.
His effort was followed by equally impressive second-half efforts from Hector Herrera, Casemiro and Vincent Aboubakar with all four of the goals coming from outside the penalty area.