Munich - Striker Mario Gomez pounced from close range in the final minute to give Bayern Munich a 2-1 victory over Real Madrid in the first leg of their Champions League semi-final on Tuesday.
Gomez converted Philipp Lahm's low cross to hand Bayern a slender lead to take into the return leg next week in Madrid.
Franck Ribery fired the Bavarians ahead in the 17th minute after Real's defence, hesitant throughout the match, failed to deal with a corner.
Bayern had chances to increase their lead but were instead pegged back when Mesut Ozil scored in the 53rd minute from close range following some sloppy home defending.
Bayern continued to press forward in a match littered with high tackles, theatrical dives and harassment of match officials from both sets of players.
Bayern were penned into their own half for the first quarter of an hour and the home crowd breathed a collective sigh of relief when Karim Benzema's shot was punched over by Manuel Neuer.
But the hosts quickly evened things up and went ahead when Ribery, who two minutes earlier had a penalty appeal turned down, fired home from around the penalty spot.
Ronaldo sent one free kick over the crossbar and another into the Bayern wall, but Real were in trouble at the back and a Bastian Schweinsteiger shot flashed wide of their goal from 25 metres.
In the run-up to half-time, Toni Kroos carried the ball from his own half and slipped it to Gomez, whose left-foot shot was superbly turned away by Iker Casillas.
Bayern started the second half brightly with Robben cutting inside and firing over the bar from just outside the area.
But some dreadful defending by the Bavarians allowed Real to equalise in the next move.
Ronaldo had a poor effort saved by Neuer but Bayern failed to clear, Benzema played it to the far post when Ronaldo pulled it back for Ozil, also unmarked, to equalise.
Gomez headed over from close range as Bayern, whose Allianz Arena hosts the final, exerted strong pressure and the hosts finally got their reward after Lahm had wriggled free on the right.