The Germany striker has conceded that the Bavarians lost control of the game during the second half and were ultimately quite lucky to have escaped with all three points
The home side took the lead just seven minutes in through Christian Gentner but Bayern posted a swift response through Gomez.
Stuttgart then saw dismissed Cristian Molinaro on the half-hour mark and their visitors made their extra man count when Gomez struck again early in the second half.
The Bavarians failed to add a third and avoided a late scare as Stuttgart’s Cacau fired over the bar after a weak back-header from Daniel van Buyten played him in on goal.
“Sometimes football is a crazy thing,” Gomez told reporters after the game. “One of their players was sent off and the game was under our control.
“[However,] it became too hectic and turned into a very close match. We were lucky that Cacau didn’t score. But, at the end of the day, we deserved to win.”
Gomez’s team-mate Arjen Robben was just as delighted that Bayern had held on to claim a victory which keeps them on top of the Bundesliga standings.
“Before the game we said that he had to win,” the Dutch winger said. “It was thought to be difficult to play against Stuttgart.
“But this was [an] important [victory] because we wanted to remain at the top of the table. That’s why we’re very happy.”
Bayern are now three points clear of reigning champions Borussia Dortmund and Schalke, with Borussia Monchengladbach each a further point back in fourth.