Bayern Munich goalkeeper Sven Ulreich saved a 95th-minute penalty as the Bundesliga leaders beat Stuttgart to move 11 points clear at the top.
Substitute Thomas Muller scored late on, turning in Kingsley Coman’s cross at the near post.
Stuttgart were then given the chance to equalise with a penalty, awarded by the video assistant referee for Niklas Sule’s foul on Santiago Ascacibar.
However, Ulreich held Chadrac Akolo’s weak effort to secure the win.
“Sven Ulreich is worth his weight in gold to us,” said Bayern coach Jupp Heynckes, whose side host Borussia Dortmund in the German Cup third round on Wednesday.
“If the players rest and free their heads, I am confident we can beat Dortmund again.”
Dortmund ended a run of seven games without a win at home as they edged Hoffenheim 2-1.
American teenager Christian Pulisic tapped home the winner in the final minute to cap a turnaround after Hoffenheim had led through Mark Uth’s neat finish.
Pierre-Emerick Aubameyang equalised from the penalty spot following a foul on Shinji Kagawa.
“We were lucky to get the second goal, the boys tried everything and threw the kitchen sink at them,” said new Dortmund head coach Peter Stoeger, who oversaw his second successive win.
Dortmund moves up to third in the table, two points behind second-placed Schalke, who drew 2-2 at Eintracht Frankfurt.