Bayern Munich closed to within a point of leaders Hoffenheim as Energie Cottbus moved out of the relegation zone.
Hoffenheim were held at bottom club Borussia Monchengladbach on Saturday, allowing Bayern to cut the gap after a 3-1 win at home to Borussia Dortmund.
The visitors silenced the Allianz Arena after just two minutes when Tamas Hajnal set up Nelson Valdez to score.
The title holders were level on 24 minutes when Ze Roberto pounced to score after Franck Ribery's shot had been saved.
It took Bayern until the 87th minute to nose ahead when Miroslav Klose scored from close range and the striker repeated the trick in the first minute of stoppage-time to seal the points.
Cottbus gained an important win in their battle to avoid relegation after a 3-1 victory at home to Hannover.
The hosts were in front on 39 minutes when Dimitar Rangelov rose well to head home a cross from Ivica Iliev.
Hannover's hopes of getting back in the game suffered a knock midway through the second half when new signing Leon Andreasen was sent off for a second bookable offence.
Cottbus took advantage when Rangelov scored his second of the game on 69 minutes and five minutes later Stanislav Angelov fired home a free-kick.
The visitors claimed a consolation eight minutes from time when Frank Fahrenhorst turned the ball home at the second attempt.