The 21-year-old had only made a handful of substitute appearances for his club following an eight-week lay-off with a knee injury, but he made an immediate impact with two goals in as many second-half minutes.
The Czech Republic had briefly topped Group D after they drew 0-0 with Wales in Cardiff earlier on Saturday, but Germany returned to the summit of the standings in the battle to guarantee a place at next summer's finals.
"I already had a lot of confidence going into this game, but I am flying high now," said Gomez. "But San Marino aren't the sort of side we are measuring ourselves against."
San Marino keeper Aldo Simoncini was one of the busiest men on the pitch as his defence leaked five second-half goals, and Germany now enjoy a two-point lead at the top of the table, but there was still some disappointment in their performance.
"We simply tried a bit too hard out there," said
midfielder Torsten Frings, who slotted home a second-half penalty.
"We didn't move the ball around very well in the first
half and San Marino closed us down quickly.
"In the second half, we raised the tempo and they had their chances to score. But whether it was 3-0 or 6-0, the important thing was getting a win."
Although Germany beat San Marino 13-0 last September, they took a long time to hit their stride. Injury played a part as Germany's coach Joachim Low was without his injured captain Michael Ballack, influentiual midfielder Bastian Schweinsteiger and forward Lukas Podolski.
Nevertheless, he still named a strong side with Miroslav Klose partnering Schalke 04's Kevin Kuranyi in a strike partnership which boasted more than 100 caps between them.
"It is always difficult to play against a team like San Marino," said Low. "They defended well and you have to work hard to break down their defence.
"San Marino were a sparring partner for us ahead of the game against Slovakia. It was important that we found some rhythm, which we did in the second-half."
Goals flow after interval
Germany had a low-key first-half and it was only 1-0 at the break after Kuranyi headed home on the stroke of half-time. But just after the interval, the home side doubled their lead when San Marino left Bayern Munich's latest signing defender Marcell Jensen unmarked at the back post to enjoy a simple tap in on 52 minutes.
And a minute later Germany went 3-0 up after San Marino defender Davide Simoncini earned himself a red card after a second bookable offence for a rugby tackle on Germany's striker Klose. The referee wasted no time giving the penalty and Werder Bremen's Frings slotted it home.
Just four minutes after coming on for Kuranyi, Gomez then made it four when he followed up Frings' free-kick on 63 minutes and won the race to stab the ball home.
He grabbed his second - and Germany's fifth - two minutes later when he followed up Jensen's shot before fellow substitute Clemens Fritz made it 6-0 on 67 minutes. Fritz came close to grabbing his second when he clipped the crossbar on 82 minutes.