FRANKFURT: Bayern Munich warmed up for its Champions League semifinal against Real Madrid with a 5-2 win over Werder Bremen in the Bundesliga on Saturday.

Bayern trailed twice but scored three goals in a seven-minute span in the second half to put the match away. Franck Ribery scored a goal and played a role in two others as his form finally improved ahead of Tuesday’s match against Madrid, which holds a 1-0 lead from the home leg.

Claudio Pizarro scored two goals for Bayern against his former club.

Bottom clubs Nuremberg and Eintracht Braunschweig both lost, which means they can only avoid relegation by reaching the playoff spot at the expense of Hamburger SV, which plays Sunday in Augsburg. There are two rounds left in the season.

Nuremberg lost 2-0 in Mainz and Braunschweig went down 2-0 at Hertha Berlin.

Wolfsburg had its hopes of qualifying for the Champions League dampened with a 2-2 draw against Freiburg at home. Hoffenheim and Eintracht Frankfurt drew 0-0. Bayer Leverkusen plays Borussia Dortmund in the late match.

Bayern’s players wore black armbands and a minute of silence was observed before kickoff in honor of former Barcelona coach Tito Vilanova, who died on Friday. Bayern also put a statement of condolences, in German and Catalan, on its website. Before becoming head coach, Vilanova was the assistant of Pep Guardiola, who is now the Bayern coach.

Guardiola, wearing a dark blue sweater instead of his customary suit, left several regulars on the bench and saw his team get off to a slow start and fall behind after 10 minutes.

Cedrick Makiadi led a counterattack and sent a perfect pass to Theodor Gebre Selassie, who slotted past Manuel Neuer.

Ribery got the equalizer 10 minutes later. Pizarro got a loose ball and sent a through pass to Ribery, who shot through the legs of Werder goalkeeper Raphael Wolf.

Pizarro nearly put Bayern ahead but Clemens Fritz made an acrobatic clearance on the line.

Aaron Hunt made it 2-1 with Bremen’s second chance. Franco Di Santo crossed long to the opposite side, Hunt easily faked Jerome Boateng and slotted inside the far post.

Neuer nearly gave a goal away when he attempted to dribble in his box and Di Santo almost stole the ball.

Bayern’s comeback began in the 54th with a corner from Ribery. Thomas Mueller headed down to the far post, where Pizarro sidefooted the ball into the net.

Three minutes later, Ribery gave a no-look pass to David Alaba, whose short feed found Pizarro unchallenged and the striker slid to knock the ball home.

In the 61st, Philipp Lahm crossed from the right and Bastian Schweinsteiger rose to send a powerful header into the roof of the net.

Arjen Robben scored in the 74th in his first possession after coming off the bench. Robben cut inside from the right in his trademark move and drove home with his left foot, finding the low corner.

Mueller headed onto the crossbar late in the match as Werder fell to its seventh straight Bundesliga defeat to Bayern.

Bayern has already clinched the Bundesliga title and is seeking to become the only club to win the Champions League twice in a row.

While its attacking game fell into place after the break, Bayern’s defense struggled against the fast break. Bayern has conceded eight goals in its last three Bundesliga matches at home.