Dortmund held after late Stuttgart leveller
Russian Pavel Pogrebnyak stunned Dortmund with an unstoppable shot from the edge of the box five minutes from time to cancel out Mario Goetze's goal in the first half.
The draw lifted Dortmund to 47 points from 19 games, with Hanover 96 second on 34 points after they lost 1-0 to Schalke 04 thanks to Spanish striker Raul's 10th goal of the season.
"We should have decided the game much earlier," said Dortmund coach Jurgen Klopp, whose team missed several chances.
"A 2-0 or 3-0 would have been deserved. We just were not clever enough and in the end we did not defend as we should have done. But we are still top of the table."
Gomez struck three times for Bayern in the second half and Dutch winger Arjen Robben scored his first goal for the club since May last year as the champions moved into third place with 33 points, their highest position this season.
Robben returned to action last week after aggravating a muscle injury at the World Cup in South Africa last July.
Gomez's hat-trick made him joint top scorer in the league alongside Freiburg's Papiss Demba Cisse on 15 goals.
"Dortmund dropped points and we won some," said Bayern coach Louis van Gaal. "Obviously we look towards the top and there is still some hope."
Mainz 05 lost 1-0 to VfL Wolfsburg to drop to fourth spot and Cologne moved out of the bottom spots for the first time in months, beating Werder Bremen 3-0 with a Lukas Podolski double and piling pressure on Bremen coach Thomas Schaaf.
In front of another 80,700 sold-out crowd, Dortmund shot out of the blocks and Robert Lewandowski should have given them the lead but his low drive narrowly missed the target.
Stuttgart, improving under coach Bruno Labbadia, briefly responded and came close with a Christian Gentner header that stretched goalkeeper Roman Weidenfeller.
But Dortmund gradually took control and the deserved lead when Goetze broke the deadlock two minutes from the break, rounding off a dazzling four-pass break from the hosts.
The second half was largely a one-sided affair and Dortmund will be asking themselves how they could have missed a handful of clear chances through Lewandowski, Lucas Barrios and Nuri Sahin.
They were caught napping and punished when Pogrebnyak completed a swift move from Timo Gebhart and Zdravko Kuzamanovic for the equaliser.