Real Madrid reached the Champions League last 16 and eased the pressure on coach Zinedine Zidane with a 2-0 win over Borussia Monchengladbach.
Karim Benzema netted two first-half headers to settle the contest in the Spanish capital, which Madrid had to win to make certain they did not crash out at the group stage of the competition for the first time.
Gladbach slipped into second spot in Group B with their defeat, but Inter s draw with Shakhtar Donetsk means the Bundesliga side join Los Blancos in the next round.
This was billed as a must-win contest not only for the 13-time European champions hopes of competing for the trophy, but also for Zidane, whose future came under intense scrutiny after last week s loss to Shakhtar.
There was a clear response to the critics as Madrid led inside nine minutes, Lucas Vazquez picking out Benzema, who headed expertly beyond the reach of Yann Sommer.
Alassane Plea should have levelled but clipped a finish wide of the right-hand post after being sent through on goal by Florian Neuhaus.
That miss was punished just after the half-hour mark, Rodrygo s wicked cross setting up Benzema for a header that was too much for Sommer to keep out.
It would have been 3-0 before the break had Sommer not got fingertips to Luka Modric s volley to turn the ball onto the post, before the excellent Madrid midfielder had an emphatic strike ruled out for an earlier offside against Raphael Varane.
Sommer made a terrific save to keep out a Toni Kroos strike, although Gladbach were certainly improved after the interval and saw another chance go begging when Plea dragged a shot narrowly wide.
Sommer was again at full stretch to claw away Sergio Ramos header before Benzema s follow-up somehow crashed off the underside of the crossbar and away, and the woodwork again denied Madrid in the closing stages when Vazquez s shot rebounded off the upright.
Champions League group stage goals:
Lionel Messi
Cristiano Ronaldo
Karim Benzema
— UEFA Champions League (@ChampionsLeague)
What does it mean? Stars stand up to spare Zidane
Given the context, this was Madrid s best performance and result of the season.
The ignominy of dropping out of the competition after 28 consecutive qualifications from the group stage would likely have left Zidane s position untenable. As it is, his key players all produced when it mattered to send Madrid through as group winners and keep their coach in a job.
Gladbach disappointed here but have done superbly overall to qualify for the next round.
Modric masterful
Modric was close to his Ballon d Or-winning standards of two years ago, especially in the first half, when he was unlucky not to score at least one excellent goal.
He attempted more passes in the opposition half (54) than any other player as he knitted the midfield and forwards together with precision.
Plea wilts on the big stage
Plea really should have scored in the first half when Madrid only led by one goal, and his miss seemed to condition the rest of his performance.
He was wayward with his two good openings and completed the fewest passes (13) of any Gladbach starting player not hauled off at half-time.
Key Opta Facts
Real Madrid have now progressed from all 29 of the Champions League group stages (including second group stage), the most of any side in the competition s history.
Borussia Monchengladbach have progressed to the Champions League knockout stages for the very first time, in what is their third participation in the competition.
Madrid topped Group B with 10 points; before 2020-21, the last side to top their Champions League group having finished with no more than 10 points were both APOEL (9) and Milan (10) in 2011-12.
Gladbach s progression means there will be four German clubs in the Champions League knockout stages for the first time since 2014-15.
Madrid s Karim Benzema (51) became the fifth player in Champions League history to score 50 goals in the group stages of the competition after Lionel Messi (71), Cristiano Ronaldo (67), Raul (53) and Ruud van Nistelrooy (50).
What s next?
Atletico Madrid visit Estadio Alfredo Di Stefano for Saturday s LaLiga derby match. Gladbach are next in action at home to Hertha Berlin.