(CNN) -- A late double from Miroslav Klose lifted Bayern Munich to a 3-1 win over Borussia Dortmund to keep the pressure on Bundesliga leaders Hoffenheim.

Miroslav Klose scores his second goal and Bayern Munich's third in their victory over Borussia Dortmund.

Bayern looked like being forced to settle for a point with time ticking down, but Klose volleyed them in front in the 87th minute and capped the victory with a close-range finish in the dying seconds.

Dortmund had taken a shock second-minute lead through Nelson Valdez but Ze Roberto cancelled that goal out midway through the first half.

The win sends Bayern back into second place, one point behind Hoffenheim.

Meanwhile, Energie Cottbus have climbed out of the relegation zone with a 3-1 win over 10-man Hannover. Dimitar Rangelov headed the hosts in front six minutes before the break but it was midway through the second half that the game swung decisively in their favor.