Bayern sneak late win over Bremen
Naldo's 51st-minute strike had put the hosts ahead but the same player put through his own net 15 minutes from time to level things up, before Ribery had the final word.
The victory moved Bayern to within five points of Borussia Dortmund, although the leaders can wrap up the title later on Saturday when they host Borussia Monchengladbach. Werder's loss extended their winless streak to seven games and left them on 42 points.
Bayern coach Jupp Heynckes rested most of his top stars ahead of Wednesday's UEFA Champions League semi-final second leg against Real Madrid. Bastian Schweinsteiger, Luiz Gustavo and Manuel Neuer were the only starters on Saturday who played in the first leg.
The visitors had the first chance of the game but Werder goalkeeper Tim Wiese made a superb save from Nils Petersen's header from eight yards in the 19th minute. The hosts went close four minutes later but Markus Rosenberg's header from five yards flew over the bar.
Petersen struck the crossbar in the 44th minute and Thomas Muller's shot was deflected over by Wiese a minute later as Bayern pushed forward looking for the lead. But it was Werder who went ahead after 51 minutes through a set-piece. Claudio Pizarro did not make a clean connection with Zlatko Junuzovic's corner but Naldo was on hand to strike home.
Ribery turns it around
Heynckes refused to take defeat lying down, introducing Ribery and Toni Kroos in the 64th minute and Mario Gomez six minutes later. Werder nearly doubled their advantage in the 74th minute after a good run by Rosenberg, but Neuer came to the rescue.
And moments later the equaliser arrived, Naldo diverting Ribery's cross from the left into his own net. Wiese made a great save from Ribery in the 79th minute and Muller's header went just over the bar a minute later as Bayern continued to press.
Werder had one final chance to regain the lead with six minutes left but Niklas Fullkrug's header from five yards out went over the bar. And in the final minute it was Bayern who grabbed all three points as Ribery got past Aleksandar Stevanovic on the left and beat Wiese at the far post for a dramatic winner.