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".
- Destiny's Child Just Reunited On Stage During Beyonce's Coachella Performance
- First Rohingya family returns to Myanmar after conflicts
- Trump on Syria airstrikes: "Mission Accomplished!"
- Vettel on police in China as Hamilton struggles
- Trump's national security team meets on Syria
- Raided Cohen's Taxi Loan Under Scrutiny — WashPost
- Irish rugby union revokes contracts of players acquitted of rape
- Nixon wins Working Families Party support against Cuomo
- RBC Heritage: Ian Poulter grabs Round 3 lead
- Popovic's Spurs Caught Out Against New-Look Warriors