Cristiano Ronaldo scored an injury-time penalty to book Real Madrid's place in the Champions League semifinals after losing the second leg 3-1, but winning the tie 4-3 on aggregate.
Juventus had wiped out Real Madrid's three-goal advantage from the first leg with Mario Mandzukic scoring twice before Blaise Matuidi levelled the tie at 3-3 after an hour.
But with the tie heading towards extra-time, Madrid were awarded a penalty following Mehdi Benatia's challenge on Lucas Vazquez.
Gianluigi Buffon was shown a red card by Michael Oliver for protesting the decision, leaving Ronaldo to score his 41st goal of the season from the spot past substitute keeper Wojciech Szczesny.
Trailing 3-0, Juventus needed a positive start to get back into the tie and Mandzukic gave the Bianconeri the perfect start by heading home Sami Khedira's lofted cross to the back post with 90 seconds played to make it 1-0 on the night and 3-1 on aggregate.
Gareth Bale came close to restoring Madrid's three-goal aggregate lead but his shot was saved by Buffon and Bale's follow-up back-heel found the side netting.
In a wide open start to the game, Isco had the ball in the back of Juventus' net, but the flag was up for offside as he followed up after Buffon spilled Ronaldo's shot.
Juventus boss Massimiliano Allegri was forced into a substitution after just 17 minutes, replacing Mattia De Sciglio with Stephan Lichtsteiner.
Juventus were indebted to their 40-year-old goalkeeper who denied Isco with a fine save after Ronaldo's through-ball created the chance.
That save proved to be crucial as three minutes later Mandzukic scored with another back-post header, this time from Lichtsteiner's cross from the right.
In added time at the end of a pulsating first half, Raphael Varane saw his header from six yards out rebound off the bar after being picked out by Toni Kroos' delivery from the left.
With half an hour to play, Juventus had wiped out Real Madrid's three-goal advantage. Keylor Navas failed to collect a cross into the box and Matuidi was in the right place at the right time to poke the ball home for an improbable equaliser.
Real Madrid searched for the first home goal of the tie and Isco forced Buffon into another good save as he turned the shot past the post for a corner from which Varane's shot on the turn sailed wide.
Ronaldo, from a similar position from where Mandzukic scored his second, failed to find the target with five minutes remaining in normal time.
The Portugal international played a pivotal role in the conclusion to the game, however. It was his header that Lucas was about to control when Benatia was adjudged to have fouled the Madrid man six yards from goal.
Buffon took his protests too far and was sent off by the English referee before Ronaldo showed great composure to fire his penalty past Szczesny and send the defending champions through to the semifinals.