The home crowd roared in the 17th minute as Franck Ribery knocked home a loose ball off a Bayern corner kick to put his side out front.
It was all smiles in Munich until the beginning of the second half, when Mesut Ozil finished a Madrid movement from point-blank range to level the match.
That's the way things looked like leading right up to the 90th minute, when Philipp Lahm danced around Fabio Coentrao to play a cross that found a lunging Mario Gomez in front of goal.
2-1 Bayern. Now we move to the Bernabeu.
Here's how the key battles in the first leg played out:
Philipp Lahm vs. Cristiano Ronaldo
Lahm is a right-back who feels as if his birthright involves bombing forward down the sideline. Ronaldo is of course one of the most dangerous attacking players in the world. Something was going to have to give. And something did.
Lahm pushed the attack and still managed to virtually shut Ronaldo out of the match. Lahm made one mistake (going to sleep during the move that resulted in Madrid's goal), but for the 90 minutes he came out on top of this battle.
The German defender's success forced Jose Mourinho to pay him the highest compliment by shifting Ronaldo to the other flank and introducing Marcelo on the left in an attempt to both find Ronaldo some joy and slow Lahm's forward thrusts.
Philipp Lahm vs. Fabio Coentrao
The Real Madrid left-back will be lambasted for his performance on Tuesday night. His critics will invariably understate the case.
Coentrao was awful in Munich. It was fitting that the deciding goal came after he was so skillfully dispatched by Lahm on the wing. The same matchup had been playing out in the same way for the entire match.
He was left on an island because of Ronaldo's refusal to track Lahm's runs, but every defender who has ever played behind Ronaldo has been in the same predicament. Few have ever dealt so poorly with the situation as Coentrao.
Whether by Lahm, Arjen Robben or a combination of the two, Coentrao was well roasted all evening. If he plays in the return leg, it will be the most surprising development of the semifinal.
Karim Benzema vs. Jerome Boateng & Holger Badstuber
For big stretches of the match, Karim Benzema looked like a very dangerous man. His runs both through the middle and into the channels were well-timed and menacing. The Bayern central pairing simply could not keep step with him.
Benzema was the most consistently menacing player in a Madrid shirt on Wednesday. He created their equalizer in the second half and was threatening any time Jose Mourinho's team could get him the ball.
Madrid's general reluctance to flow forward into attack did more to handcuff the Frenchman than either Boateng or Badstuber.
Mario Gomez vs. Bad Luck
If Bayern's striker had even been statistically average in his finishing, the Germans would have won in a rout. For 89 minutes, it looked like the story of the match would be Gomez's wasted chances.
Gomez let at least three gilt-edged chances go wanting. But in the 90th minute he redeemed himself by finishing a wonderful cross provided by Lahm. The ball might have hit Gomez three times as he bundled it toward goal, but Bayern fans won't mind the ugliness of the finish.
The striker finally beat his bad luck. But if Real Madrid are able to overcome the slim margin next week, Gomez will find himself reliving Tuesday's chances in his dreams all summer long.
Winner: Let's call it a draw
Franck Ribery vs. The Sniper in the Stands
Ribery was undoubtedly one of the brightest players on the field for either side on Tuesday. He was lively on the ball and off. There wasn't a Madrid defender who consistently shut him down.
But Ribery's continuous flopping to the ground in a blatant attempt to get Real Madrid players booked was disgraceful.
He dove in the area. He dove in midfield. If he'd received the ball in his own half, you would have bet your last penny on him throwing himself to ground there as well. If he was touched, he dove.
Even Bayern supporters must have been begging referee Howard Webb to book Ribery just so he would get on with things.
Winner: The Sniper in a landslide
It would be beyond shocking if Coentrao gets a chance to redeem himself in Real Madrid's home leg. Jose Mourinho is not traditionally forgiving of defenders who perform poorly on big stages.
But the rest of these matchups will replay themselves when Bayern and Real Madrid take the field for the second leg of their semifinal.
The deciding match kicks off on Wednesday, April 25th at the Bernabeu.