Mario Gomez scored in the 90th minute Tuesday to give Bayern Munich a 2-1 win over Real Madrid in the first leg of their Champions League semifinal.

Gomez's 12th goal of this year's competition boosted Bayern's hopes of becoming the first team to play the Champions League final at its own stadium, and earn its fifth title.

Franck Ribery opened the scoring in the 17th minute for Bayern Munich and Mesut Oezil equalized in the 53rd.

The second leg is next week in Madrid.

The other semifinal begins Wednesday when Barcelona is at Chelsea.

Real took its first defeat in the Champions League this season, but the away goal could be decisive for the nine-time champions.

Gomez knocked the ball in after Philipp Lahm broke through on the right and sent in a low cross. Gomez powered through to extend his right leg and prod the ball home from close range.

Ribery put in a shot from inside the penalty area after Real had failed to clear a corner kick by Toni Kroos, with Sergio Ramos practically chesting the ball down for the Frenchman to score the first goal.

The equalizer came with Bayern's defense looking uncharacteristically in disarray. Goalkeeper Manuel Neuer stopped Cristiano Ronaldo's effort, but could not hold the ball. Real regained possession, with Oezil passing to Karim Benzema, who found Ronaldo again. The Real star passed across the goal for Oezil to score from 2 yards.