After midfielder Toni Kroos put the hosts ahead at Munich's Allianz Arena with a well-taken first-half chip, Germany striker Mario Gomez extended his tally as the Bundesliga's top scorer with his 23rd goal in 26 matches.
He rolled his shot under Hannover goalkeeper Ron-Robert Zieler on 68 minutes to claim Bayern's second before Ivory Coast striker Didier Ya Konan pulled a goal back with a spectacular bicycle kick on 74 minutes.
Hannover, who face Atletico Madrid in the first-leg of their Europa League quarter-final on Thursday, could have rescued a point as ex-Manchester United striker Mame Diouf headed over the bar with time almost up.
"You can see why Hannover 96 are in the last eight of the Europa League and the top third of the league table," said Bayern coach Jupp Heynckes, whose team beat Mönchengladbach on penalties on Wednesday in the German Cup semi-final.
"They were well organised and not easy to play against. Overall, we deserved the win and I am very satisfied. We now have to just win our games and worry about ourselves. The team did well just two-and-a-half days after our cup win."
With Dortmund at Cologne on Sunday in the Rhineland derby, Bayern took the opportunity to cut the defending champions lead, leaving them on 57 points to Dortmund's 59 with seven matches left.
Third-placed Borussia Mönchengladbach slipped further back in the title race when they threw away the lead to lose 2-1 at home to Hoffenheim, which leaves them six points behind Bayern, eight behind Dortmund.
Gladbach were cruising to victory after a first-half goal from Dortmund-bound midfielder Marco Reus seven minutes before half-time but Hoffenheim took the three points with two goals in as many second-half minutes.
Brazil midfielder Roberto Firmino earned a yellow card for his shirtless celebrations on 77 minutes before a sharp header from Boris Vukcevic on 79 minutes scuppered Gladbach's hopes.