Robert Lewandowski's brace booked Bayern Munich their berth in the German Cup final after beating resilient Werder Bremen 3-2 in the semifinals on Wednesday.

To reach the final was a tough piece of work for the German record champions, who established a two-goal lead at the hour mark before Werder Bremen bounced back within one minute from two goals down. However, Bayern secured the win in the closing period when Lewandowski converted an awarded foul play penalty.

From the kick off, Werder Bremen made Bayern's life difficult and kept the visitors on the distance in the first 30 minutes.

As the match progressed, Bayern came close to open the scoring through Thomas Muller and Kingsley Coman. Their efforts soon got rewarded as Lewandowski poked home Muller's header to the far post from very close range in the 36th minute.

The "Bavarians" thought they had doubled the lead just before the half time but Muller's shot on target was ruled offside.

After the restart, both sides came out highly motivated and exchanged opportunities but neither Serge Gnabry nor Kevin Mohwald were able to score at either end of the pitch.

Bayern doubled the lead on 63 minutes and seemingly killed the game when Muller slotted home Leon Goretzka's blocked shot from inside the box.

However, Bremen responded well as Yuya Osako reduced the arrears following a square pass from Milot Rashica 11 minutes later.

Bayern were shocked and wobbled, and Bremen took over control to level the scores only moments later after Rashica danced through the visitor's defense to slot home from tight angle.

Niko Kovac's men recovered from the shock and flabbergasted the hosts in the closing period as Theodor Gebre Selassie fouled Kingsley Coman inside the box allowing Robert Lewandowski to convert the penalty into the bottom right and to seal the deal.

"I can only thank my team. They gave everything," Werder Bremen head coach Florian Kohfeldt said.

"I think we deservedly made it into the final because we had the better chances. It was an expected clash where we needed a last bit of luck on our side," Bayern head coach Kovac said.

Bayern reached the German Cup final for the 23rd time and will encounter Leipzig on May 25.