The victory means that Germany have now won all four of their Group C matches to top the section on 12 points, while San Marino remain bottom, having lost each of their four matches during this campaign.
It took just seven minutes for the visitors to make the breakthrough - Ilkay Gundogan setting up Sami Khedira, who buried the ball into the bottom corner from close range to send Germany on their way during what was a comfortable night.
Two minutes later, it was 2-0 as former Arsenal youngster Gnabry grabbed his first from close range, before Mario Gotze teed up Jonas Hector in the 32nd minute as Germany, who had a whole host of first-half chances, took a three-goal lead into the break.
Gnabry grabbed his second just before the hour after being released by Joshua Kimmich, before Gotze again set up Hector in the 65th minute and the left-back found a route past Aldo Simoncini to make it five.
Gnabry then bagged his hat-trick in the 76th minute to cap a memorable Germany debut as the 21-year-old collected a cross from Thomas Muller before firing into the back of the net.
It was to get worse for the home side, however, as an own goal from Mattia Stefanelli made it 7-0 in the 82nd minute, before Kevin Volland netted four minutes later to cap a miserable night for San Marino. body check tags ::