The reigning European champions entered the match holding a 3-0 advantage from the first leg in Turin, but Juventus hit back with three goals of their own to leave the tie level at 3-3 entering stoppage time at the end of the 90 minutes.
Ronaldo spectacularly sent Los Blancos into the final four, however, when he converted from the penalty spot after Medhi Benatia had felled Lucas Vazquez, with the aftermath seeing Juventus goalkeeper Gianluigi Buffon receive a straight red card for dissent.
Los Blancos have joined Bayern Munich, Liverpool and Roma in the final four as they bid to win the European Cup for the third year in a row.
It took Juventus less than two minutes to make the breakthrough in the Spanish capital, with Mandzukic heading a deep Sami Khedira cross into the back of the net from close range.
The visitors came close to cutting the aggregate score to 3-2 in the eighth minute when the ball fell kindly for Gonzalo Higuain inside the box following good work from Douglas Costa, but Los Blancos goalkeeper Keylor Navas made a smart save.
Real Madrid came close themselves two minutes later when Luka Modric released Bale inside the Juventus box, but the Welshman could not poke the ball past Buffon.
The hosts had the ball in the back of the Juventus net in the 14th minute when Isco converted from close range following a loose save from Buffon, but the offside flag was raised despite replays showing that the Spaniard was onside.
Mandzukic then bundled into the arms of Navas from close range as chances continued to arrive at either end.
Marcelo was next to come close for Real Madrid just before the 30-minute mark, but the Brazilian saw his powerful drive miss the Juventus crossbar, before Toni Kroos had a goal-bound strike blocked by Pjanic.
Isco had a huge chance to level the scores in the 35th minute when he was released by Ronaldo inside the Juventus box, but Buffon was on hand to make an excellent save.
Juventus then went down the other end and scored their second as Mandzukic headed a super Stephan Lichtsteiner cross into the corner of the net to stun the Bernabeu into silence.
Real Madrid almost registered in the latter stages of the first half when Raphael Varane met a free kick from Kroos, but the Frenchman saw his effort hit the crossbar before Juventus cleared their lines.
Ronaldo was the first player to register a shot on target in the second period, but the Portugal international's effort, which arrived just before the hour, was saved by Buffon, before Navas kept out a Higuain strike down the other end.
Juventus had their third in the 61st minute, however, when Matuidi tapped home from close range following a poor piece of goalkeeping from Navas, who dropped a routine cross from Costa.
The tension inside the Bernabeu was incredible as the match headed for its final 20 minutes of normal time at 3-3 on aggregate, and with Juventus continuing to cause problems.
Khedira had a clear sight of the Real Madrid goal 15 minutes from time, but Vallejo was across to make a fine block as the home side continued to wobble at the back.
Buffon then got down to keep out a powerful Isco strike down the other end, before Varane just missed the far post moments later as the score stayed at 3-3.
Ronaldo had a super chance to register for Real Madrid five minutes from time when he met a deep cross from Dani Carvajal, but the attacker's header flew over the crossbar.
It did appear that the contest would be heading for extra time, but Real Madrid were awarded a penalty in stoppage time when Benatia bundled Vazquez to the ground, and after Buffon had been sent off for dissent, Ronaldo smashed the ball past Juventus's substitute goalkeeper Wojciech Szczesny.
Ronaldo picked up a yellow card for removing his shirt in the celebrations that followed, but it was once again the Portuguese that came to the forefront when his team needed him the most.
REAL MADRID (4-3-3): Navas; Carvajal, Varane, Vallejo, Marcelo; Casemiro (Lucas 46'), Kroos, Modric (Kovacic 75'); Isco, Ronaldo, Bale (Asensio 46')
JUVENTUS (4-3-3): Buffon; De Sciglio (Lichtsteiner 17'), Benatia, Chiellini, Sandro; Khedira, Pjanic, Matuidi; Costa, Higuain (Szczesny 96'), Mandzukicbody check tags ::