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 leveled 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.
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 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.
Atletico Madrid visit Estadio Alfredo Di Stefano for Saturday's LaLiga derby match. Gladbach are next in action at home to Hertha Berlin.