Gnabry, 21, is the first German to score a hat-trick on his debut since Dieter Mueller achieved the feat for West Germany in 1976.
Ex-Arsenal winger Serge Gnabry scored a hat-trick on his senior Germany debut in Friday's 8-0 World Cup victory at San Marino as coach Joachim Loew set a new record.
Gnabry, 21, who left the Gunners before the start of the season, is the first German to score a hat-trick on his debut since Dieter Mueller achieved the feat for West Germany in 1976.
"Of course, I didn't expect the hat-trick and I'm delighted to have helped the team," said Gnabry who joined Werder Bremen in August after a lack of chances at Arsenal.
"The last few years have been hard for me, so it's nice to have had a few goals and I hope it keeps going well."
Cologne left-back Jonas Hector also netted twice after Germany's stand-in captain Sami Khedira opened the scoring.
Mattia Stefanelli scored a late own goal before substitute Kevin Volland netted Germany's eighth.
Germany maintain their perfect record of four wins to stay top of their 2018 World Cup qualifying group and five points clear of nearest rivals Northern Ireland.
After a decade in charge, this was Loew's 95th victory, in his 142nd international as coach, to better the 94 wins of legendary Sepp Herberger, who steered West Germany to the 1954 World Cup title.
"We wanted to score as many goals as possible and let them do the running. It worked out well," said Loew.
"Gnabry has showed for Werder, and for us in training, that he's in good form."
With Toni Kroos and Jerome Boateng injured, Loew gave debuts to both Gnabry and 19-year-old Bayer Leverkusen right-back Benjamin Henrichs.
Germany romped to a 13-0 win on their last visit to Serravalle in 2006 and took just seven minutes to take the lead against San Marino's part-timers.
With goalkeeper and captain Manuel Neuer missing with a virus, Khedira skippered Germany and put his side ahead.
In pouring rain, Manchester City's Ilkay Gundogan spotted Khedira's run into the box and the defensive midfielder buried his shot.
Gnabry doubled the lead when a clearance from defender Davide Simoncini went straight to the Werder winger.
His shot beat Simoncini's twin brother Aido in the San Marino goal on nine minutes.
Hector found himself in the strikers' position when Mario Goezte's pass picked him out and he tucked away Germany's third on 32 minutes.
Mario Gomez stroked Thomas Mueller's pass into the net, but he was incorrectly flagged for offside and it stayed 3-0 at the break.
The San Marino FA's Twitter account gleefully pointed out their half-time score was better than Brazil's 5-0 during the 2014 World Cup semi-final.
Gnabry grabbed the fourth on 58 minutes after converting Joshua Kimmich's floated pass over the defence.
Then Hector added his second after good work from Goetze opened up the defence on 65 minutes.
Schalke's Max Meyer replaced Goetze for the final 20 minutes and hit the post with his first touch of the ball.
Gnabry wrapped up his hat-trick 14 minutes from time before Stefanelli, who became a national hero by scoring their goal in last month's 4-1 defeat to Norway, turned the ball into his own net.
Volland then came off the bench to score the world champions' eighth four minutes from time.