Cristiano Ronaldo scored a hat-trick to send Real Madrid through to the Champions League semi-finals with a 4-2 extra-time win against 10-man Bayern Munich to seal a 6-3 aggregate victory in controversial circumstances.
A bizarre Sergio Ramos own goal forced the extra period after Robert Lewandowski opened the scoring for Bayern from the penalty spot and Ronaldo equalised.
Marcelo twice cleared off the line for Madrid and Jerome Boateng did the same for Bayern in a thrilling game, which was tilted in Madrid's favour by Arturo Vidal's dismissal for two yellow cards, the second of which was harsh.
Ronaldo put Madrid level at 2-2 on the night in the first period of extra time when he scored his 100th Champions League goal, from a clearly offside position, before he wrapped up his treble and Marco Asensio added a fourth.
Carlo Ancelotti's Bayern began well, with Thiago Alcantara's close-range shot brilliantly blocked on the goal line by Marcelo. Arjen Robben lashed the rebound into the side-netting.
Vidal crashed a strike inches over the crossbar and Real goalkeeper Keylor Navas had to be quick off his line to beat Ribery to a through-ball.
Madrid began to find their feet and were soon dominating, with the effervescent Marcelo crossing for Karim Benzema, who headed wide, and Dani Carvajal also firing an effort just off target.
Ramos nearly put the hosts ahead after the otherwise superb Manuel Neuer spilled a shot, but Jerome Boateng somehow blocked his effort on the line to keep his side in the tie.
Toni Kroos fired over and Ronaldo shot when he should have passed to Benzema as Madrid ended the first half looking far more dangerous than their opponents.
However, it was Bayern who took the lead when Casemiro fouled Robben in the area and Lewandowski sent Navas the wrong way from the spot.
Ronaldo levelled the score, heading beyond Neuer in the 76th minute from a fine cross by Casemiro, but Bayern restored overall parity within a minute.
Ramos, so used to being Madrid's hero, turned villain when he shinned the ball into his own net after a scramble in the area.
With the game heading towards extra-time Vidal was sent off for a second booking after appearing to win the ball cleanly from Asensio.
It gave Madrid the upper hand going into the added 30 minutes and they took advantage when Ronaldo scored the crucial second from Ramos's cross, despite being in an offside position.
Madrid added two more late on, leaving Bayern exhausted and angry.