Thomas Muller (centre, arms raised) celebrates after scoring for Bayern Munich against Borussia Dortmund on Wednesday night. Photo: Lukas Barth/EPA

BERLIN – Thomas Muller scored the decisive goal as Bayern Munich fought to a 2-1 victory over rivals Borussia Dortmund to reach the German Cup quarter-finals on Wednesday.

Goals from Jerome Boateng and Muller gave Bayern a comfortable lead before halftime, but Andriy Yarmolenko’s second-half header made it a nervy last 15 minutes for Bayern.

After several gilt-edged chances in the opening minutes, Boateng headed Bayern into the lead on 12 minutes. Niklas Suele guided a James Rodriguez free kick on to the bar, before Boateng emerged to nod the ball past Roman Buerki.

With star striker Pierre-Emerick Aubameyang out injured, it wasn’t until the 35th minute that Dortmund created a significant chance.

Stand-in front man Yarmolenko found space in the box, only to see his shot cleared off the line by David Alaba.

Minutes later, Bayern doubled their lead in style. Played through by Robert Lewandowski on the right wing, Muller sent an elegant chip over Buerki and into the far corner.

Two brilliant saves from Buerki kept Bayern from running riot just after halftime, but Bayern looked ever more comfortable as the game wore on.

When Franck Ribery was substituted off on the hour mark, the win appeared to be secure.

Bayern were shocked into life on 76 minutes, though, when Yarmolenko pulled a goal back for Dortmund. 

Shinji Kagawa whipped in a cross, and home goalkeeper Sven Ulreich couldn’t deny the Ukrainian at the far post.

Dortmund could muster little more than a handful of half-chances as they pushed for the equaliser.

Only in injury time did they create a golden opportunity, as Alexander Isak’s shot was deflected just inches past the post.

Elsewhere, Leon Bailey netted the winner as Bayer Leverkusen beat Borussia Moenchengladbach 1-0 to book their place in the quarters.

Goalless until the 71st minute, the game burst into life when Bailey broke down the left to pick up Kevin Volland’s through ball and fire past Yann Sommer.

Werder Bremen also progressed to the last eight by beating Freiburg 3-2.

After goals from Ishak Belfodil and Florian Kainz had put Bremen two goals up, Nils Petersen pulled a goal back from the penalty spot.

With 20 minutes to play, Philipp Bargfrede swept the ball in for Bremen’s third, the referee overruling the linesman’s offside flag. A late goal from Yoric Ravet proved too little for Freiburg.