Madrid: Cristiano Ronaldo rescued Real Madrid in the Champions League on Tuesday with two goals in a pulsating 4-3 defeat to Schalke that saw the holders squeeze through to the quarterfinals with a 5-4 victory on aggregate.
Madrid's first scare of the night came when Schalke's Christian Fuchs opened the scoring in the 20th minute, only for Ronaldo to head an equalizer for the hosts five minutes later from Toni Kroos' corner.
Madrid then made three defensive errors in a row that culminated in Klaas-Jan Huntelaar hitting the post in the 40th and scoring seconds later after connecting with Madrid 'keeper Iker Casillas' clearance of a Max Meyer shot.
Ronaldo headed home again five minutes later to set an all-time record of 78 goals in UEFA club competitions, one more than former Real Madrid forward Raul Gonzalez, and settle nerves at the Santiago Bernabeu Stadium. It was also his 75th goal in the Champions League, where he joins Lionel Messi as the top scorer between the group stage and the final.
France striker Karim Benzema then dribbled past two defenders before calmly steering home Madrid's third goal in the 53rd minute.
However, Schalke's Leroy Sane curled a superb shot over Casillas in the 57th to level on the night before former Madrid player Huntelaar made it four for Schalke in the 84th. One more goal for the German side in the final minutes would have sent it through on the away goals rule with a sensational result.
"We had problems in all aspects of our game," Madrid coach Carlo Ancelotti said. "We have to say it clearly, we are playing very badly. It's almost incomprehensible considering how we were playing before Christmas."
Ancelotti said the return from injury of Sergio Ramos will help the team because the defender provides a "sense of responsibility and character."
Schalke coach Roberto Di Matteo was meanwhile stoical in defeat.
"We tried everything to stay in the competition, nevertheless, it was not enough," he said. "We are happy we won, but we scored four goals and were eliminated.
"Madrid didn't get their pace because we didn't let them, but in the end they proved their quality, with very few chances they scored three goals."
The night's other last 16, second leg game saw FC Porto hammer Basel 4-0 to complete a 5-1 victory on aggregate.
Ancelotti began with Ronaldo, Benzema and Gareth Bale in attack and German internationals Sami Khedira and Kroos in midfield alongside Francisco "Isco" Alarcon.
Midfielder Luka Modric was on the bench after having been sidelined for four months with a torn thigh muscle, but the playmaker was loudly applauded by fans when his name was called out before kickoff.
Schalke missed a clear chance to score when 19-year-old Meyer raced up the left and crossed to Eric Choupo-Moting, who shot wide from close range in the 10th minute.
Meyer once again sprinted clear of Madrid's defense in the 18th but missed the target with his shot.
Fuchs scored when he connected left-footed with a cross supplied by Tranquillo Barnetta, with Casillas getting a touch on the ball but being unable to stop it ricocheting into the net.
With Schalke determined to take the game to the defending champions in the early stages, Ronaldo's initial equalizer from a Kroos' corner was Madrid's first shot on goal.
Sane came on for Choupo-Moting in the 29th after the Cameroon international picked up an ankle injury in a clash with Khedira.
Ronaldo was shown a yellow card in the 31st for a reckless challenge on Marco Hoger before adding his second goal of night after again being left unmarked in the area.
After Benzema restored Madrid's lead, Modric came on in the 58th minute to cheers from the crowd.
Though Sane's barreling drive from outside the area was too good for Casillas, the Madrid keeper did manage to block Barnetta's shot in the 62nd, while Timon Wellenreuther saved Alvaro Arbeloa's effott from a Bale cross three minutes later at the other end.
Huntelaar ensured a tense finale, but Madrid managed to hold on for a place in the last eight.
Di Matteo said his team has often been criticized for being too defensive but the performance against Madrid proved that a well-organized defense can be offensive as well.
"Although it's not usual to have chances to score four goals," he added.
Earlier, hundreds of blue-clad Schalke fans had been escorted by riot police to the Bernabeu, closing off part of the city's main La Castellana boulevard, hampering rush-hour traffic.
One bloodstained fan was arrested on Monday night in the downtown Puerta del Sol square after pouring beer over a police officer.