And things got worse for Madrid before they got better as Blaise Matuidi levelled the tie at 3-3 following a howler from Keylor Navas, the Costa Rica goalkeeper spilling the ball just yards from goal.
But Madrid were given a last-gasp penalty when Mehdi Benatia bumped into Lucas Vazquez inside Juventus' area.
The crowd at the Bernabeu stadium, perhaps remembering the ovation Juventus fans gave Ronaldo after his spectacular bicycle kick goal in the first leg, cheered the Italian veteran as he walked off the pitch.
Buffon had announced in October that this would be his last Champions League campaign unless his side won the final, after which he had meant to play in the Club World Cup.
The Los Blancos were struggling to book their place into the semi-finals of the Champions League after visitor's Juventus scored three goals in a space of sixty minutes to cancel out the three away goals they conceded in Turin.
But Juventus, inspired by AS Roma's giant-killing performance on Tuesday to eliminate Barcelona from the competition, were determined not to go quietly. You have to fight to the end.
In the night's other quarterfinal, Bayern Munich advanced with a 0-0 home draw against Sevilla as the newly crowned Bundesliga champions defended a 2-1 advantage from the first leg.
Zinedine Zidane says he has no explanation for Real Madrid's sublime European form, suggesting only that LaLiga is a tougher competition to win. But I liked it, it was very exciting, and in the end we went through.
I knew I'd be decisive.
"But we are happy and we are in the semi-finals".
After Barcelona let a 4-1 first-leg lead slip away to Roma on Tuesday to crash out of the Champions League in humiliating fashion, Real Madrid nearly followed them with an even worse capitulation on Wednesday.
"I think you'll find that there is a lot of belief in the Liverpool side now because they are close enough", the Arsenal legend explained. "We deserved to go through to the semis, which is what interests me most".
- Canada's Brooke Henderson soars to four-shot victory at LPGA Lotte Championship
- CWG 2018: India finishes third with 26 gold medals
- Pep Guardiola Charged with Improper Conduct After Being Sent off vs. Liverpool
- Buffon Refuses To Apologise Regarding Michael Oliver Comments
- Arab League summit kicks off with focus on Jerusalem conflict, Syrian crisis
- Cops: Murderer on the Run Killed Lookalike to Steal ID
- Russia claims Syria chemical attack was staged by United Kingdom
- First Rohingya family returns to Myanmar after conflicts
- Lake Street Advisors Group LLC Purchases Shares of 6690 Enbridge (NYSE:ENB)
- Nicki Minaj Tame Her Gang After Quavo Apologize To Her