( CNN ) -- Mario Gomez gave Bayern Munich a precious 2-1 advantage in their Champions League tie against Real Madrid with an 90th minute winner in the first leg in the Allianz Arena Tuesday . The match looked headed for a draw until the prolific striker connected with Philipp Lahm 's right wing cross to give Bayern a deserved victory . They had gone ahead through Franck Ribery in the first half with Mesut Ozil leveling in a rare Real Madrid attack just after the break . Gomez had endured a frustrating night , wasting an earlier gilt-edged chance to put them ahead for a second time when he shot over from close range . But he was rewarded for his persistence with his 40th goal of the season to give the Bavarian giants real hope of reaching the final which will be played in their home stadium next month . English Premier League Chelsea entertain reigning champions Barcelona in the second semifinal first leg Wednesday . La Liga leaders Real had gone into their away tie as favorites to progress , but from the early moments it was clear Bayern would be a difficult proposition . Ribery felt he should have had a penalty when his shirt was tugged by Sergio Ramos , but English referee Howard Webb waved away the protests . The French international did not have long to wait to be celebrating as he latched on to a loose ball in the Real penalty area from a corner and lashed his shot past Iker Casillas . Gomez had the first of his chances before halftime as Casillas turned behind his shot and it looked to be costly as Real equalized in the 53rd minute . Cristiano Ronaldo wasted the first chance as his weak shot was saved by Manuel Neuer . But Karim Benzema picked up the rebound and his shot across the goal came to Ronaldo , who cut it back for Ozil to shoot home from close range . It was the precursor for a good spell for Real but Bayern regrouped and began to create opportunities again . Gomez lifted his effort over in the 71st minute and then headed straight at Casillas . He also had penalty appeals waved away before striking late in typical fashion after superb work from the tireless Lahm . Real boss Jose Mourinho , whose team face an El Clasico showdown with Barcelona Saturday , is still confident his team will progress . `` We have the second leg to come and it 's not like we have to make a historical comeback , what we have to do is very achievable , '' he told gathered reporters . `` If we win at home , we are there . I am optimistic we can return here to play the final . ''
Bayern Munich beat Real Madrid 2 - 1 in Champions League semifinal first leg . Mario Gomez scores 90th minute winner in Amsterdam derby . David Ozil scores in Ribery 's first half opener for Bayern . Barcelona play Chelsea in second semifinal Wednesday .