(CNN) -- Bayern Munich will enjoy home advantage when they play Chelsea in the European Champions League final after defeating Real Madrid at the Santiago Bernabeu following Wednesday's dramatic penalty shootout.
Bastian Schweinsteiger struck the winning penalty kick after nine-time champions Madrid won the second leg semifinal 2-1, leveling the tie 3-3 on aggregate, and forcing the match into extra time.
After a goalless 30 minutes, the match went to penalties. Bayern won the shootout 3-1 and booked their place in a final that is to be hosted at the German club's Allianz Arena stadium on May 19, where home fans will be hoping for a fifth European crown and first since 2001.
"That was a magical night," said Bayern coach Jupp Heynckes, who in 1998 led Real to the European title for the first time in 32 years before being sacked after only one season in charge.
"We were in real trouble in the first 15 minutes, but after that we played outstanding football for long periods. I'm specially delighted for my players and the club management."
Madrid started in explosive fashion, dominating the opening exchanges, and quickly won a controversial penalty when Bayern defender David Alaba was adjudged to have handled the ball even though it had been blasted at him from close range.
Cristiano Ronaldo converted the penalty, leveling the tie almost as soon as it had begun.
And things got worse for Bayern when Madrid's German play maker Mesut Ozil slide a perfect pass into the path of Ronaldo who coolly slotted home his, and Madrid's, second. Incredibly the two goals were Ronaldo's 55th and 56th of the season.
But even with a two-goal cushion Madrid never looked particularly comfortable following their exertions defeating arch-rivals Barcelona in the Spanish league last Saturday.
"The final will be disputed between the fifth team in the Premier League and the runners-up in the Bundesliga," Real coach Jose Mourinho said after failing to set up a clash with his former club Chelsea.
"Both used their reserve players this weekend, while Real Madrid and Barcelona faced each other in the most important match of the season in the Spanish league. People listened to me when I said the calendar had to be adjusted in these circumstances in Italy, and it made me happy.
"I don't have that power or enjoy such respect for my opinions here in Spain. We've started the most important month of the season with midweek games and it's resulted in yesterday's and tonight's results. Bayern won and were luckier than us."
The Portuguese coach lifted the trophy with Porto in 2004 and led Inter Milan to victory over Bayern in the 2010 final but has fallen at the last-four stage in his two seasons with Real -- and could also take Chelsea no further than the semis.
With Germany international Mario Gomez causing Madrid's static defense problems and former Real and Chelsea player Arjen Robben using his pace to good effect, Bayern carved out chance after chance.
It was to be another, less controversial penalty decision that would throw the visitors a lifeline when Portugal defender Pepe bundled over Gomez. Robben dispatched the penalty kick even though Iker Casillas got a hand to the ball. It wouldn't be the last time he would get his hand to a penalty kick.
That goal meant that even though Madrid led 2-1 by halftime, the tie was level 3-3 on aggregate following Bayern's 2-1 first leg victory in Munich last week.
Perhaps unsurprisingly the second half was a tense affair devoid of the fluidity that had marked the first period. The game ground down to an attritional stalemate as the final whistle was blown and the match went to extra time.
Again the two teams couldn't be separated and the match went to penalty kicks.
Ronaldo approached to take Madrid's first, having not missed a penalty all season with 13 goals from the spot. But sensationally his kick was saved by Bayern's Manuel Neuer. When Kaka saw Madrid's second penalty clawed away by an even better Neuer save, the home side seemed dead and buried.
But Iker Casillas pulled out two stunning saves of his own to level the shootout. It wasn't to last. Sergio Ramos blasted over and Schweinsteiger stepped up to send the Germans home.