The 35-year-old French winger, who had come on for the injured Serge Gnabry midway through the first half, shook off two markers and fired in from 10 metres to break the deadlock as Bayern notched their fourth consecutive league win.

Bayern, back to winning ways after a dip in form earlier in the campaign, are third in the table on 33 points, behind second-placed Borussia Moenchengladbach, who were 2-0 winners against Nuremberg on Tuesday, on goal difference.

“You could tell this was a very important game,” said Bayern forward Thomas Mueller. “We would have liked to have a bit more flowing game and we also made mistakes with possession.

Dortmund, who suffered their first league defeat of the season on Tuesday after losing 2-1 at promoted Fortuna Duesseldorf, are on 39. Leipzig are fourth on 28.

Bayern were far from their best and both teams hit the woodwork in the first half before the in-form Gnabry had to be taken off injured.

The hosts were no real threat for much of the second half, with Robert Lewandowski isolated up front.

Their best chance came in the 79th minute when Joshua Kimmich headed goalwards from a metre out, but his effort was blocked by keeper Peter Gulacsi, who had sprinted back from the other side of his goal.

The Hungarian, however, could do nothing when Ribery drilled in with seven minutes remaining.

The winger, who is his last season in Munich, has lost his starting spot to Gnabry this season.

Both sides ended the game with 10 men after Leipzig’s Stefan Ilsanker was sent off for a reckless foul on Thiago Alcantara in stoppage time and Bayern’s Renato Sanches followed suit with a second booking for pushing him in the ensuing melee.

Schalke 04, wearing shirts with names of coal pits in the area to mark the end of mining in the Ruhr valley later this month, slumped to a 2-1 home defeat by Bayer Leverkusen.

The Royal Blues, last season’s runners-up, are now just a point above the relegation playoff spot.

Werder Bremen and Hoffenheim shared the points in a 1-1 draw.