Jupp Heynckes side continued its march towards the Bundesliga title despite putting in a less than virtuoso performance against the relegation-threatened host.
The Bundesliga leader was far from its best, but in a rare start, Gomez produced a close range finish to seal the victory.
The win means the Bavarians remain 17 points ahead of Borussia Dortmund at the top of table while Hoffenheim stays embroiled in a relegation battle.
The league leader looked to stamp its authority on the game early on, and Bastian Schweinsteiger tested Heurelho Gomes with a low free kick that the former Tottenham goalkeeper could only turn round the post.
Despite its lowly league position, Hoffenheim wasn't going to let the Bayern have everything its own way, and Danny Williams should have done better when a cross from the left evaded three defenders before finding him at the back post. The midfielder could only find the side netting with that effort, but that didn't deter him and he tried his luck minutes later, though he again missed the target with a powerful shot from distance.
Both sides were failing to make any real periods of possession count until Franck Ribery headed Jerome Boateng's diagonal ball into Gomez's path, and the Germany international made no mistake as he squeezed the ball into the bottom corner despite pressure from Gomes.
Breaking the deadlock certainly galvanized Jupp Heynckes' side, and the team almost doubled its lead before the break when skipper Philipp Lahm broke into the box and saw his effort parried away by Gomes.
Williams was proving the biggest threat for the home side, and he almost grabbed an equalizer on the verge of halftime as he forced Tom Starke into a save low to his right after breaking from midfield.
The start of the second half offered little in the way of goalmouth action, and it wasn't until the 67th minute that either side had a meaningful effort on goal as Stephan Schrock forced Starke into an acrobatic save from the edge of the area.
Marco Kurz's team was beginning to show much more attacking prowess, though it nearly fell further behind as Schweinsteiger's free kick beat Gomes but crashed back off the crossbar.
Midfielder Schweinsteiger was a constant danger from dead ball situations, and he again rattled the woodwork from a free kick as the match entered its final 15 minutes with his curling effort rebounding back off the post.
Mario Mandzukic replaced Gomez up front, and he went close to sealing the points as his placed header drifted narrowly wide of the right post.
In searching for an equalizer, Hoffenheim began to leave gaps in defense, and Ribery and David Alaba both almost took advantage, but Gomes was equal to both efforts from the edge of the area.
The home side huffed and puffed as it looked to claim an unlikely point, but Heynckes' side was ultimately comfortable in closing out the win.