Scotland dominated possession from the off amid torrential rain at Hampden Park, and were rewarded after just 12 minutes when McGinn latched on to the end of a bending Ryan Christie effort for a tap-in.
McGinn doubled his side's lead 15 minutes later after capitalising on some shaky keeping from the otherwise impressive Aldo Simoncini, and the Aston Villa midfielder went on to secure a first half hat-trick on the stroke of half-time, smashing a half-volley in from three yards following a corner.
The rain was unrelenting and threatened Scotland's passing football and the game itself as the fear of abandonment loomed large, but Scotland kept on pressing and Lawrence Shankland scored his first for his country after swiping into an empty net after Scott McTominay's shot rebounded off the bar.
Stuart Findlay grabbed the fifth on his debut two minutes later, heading in from a corner, and substitute Stuart Armstrong completed the thrashing three minutes from time with a wonderful free-kick that few 'keepers in the world could have saved.
Neither Scotland nor San Marino can qualify automatically for Euro 2020 through Group I, but Steve Clarke's side can still qualify through the play-offs earned by finishing top of their Nations League group last year. The win will provide a welcome morale boost ahead of that all important play-off in March.
MAN OF THE MATCH
John McGinn (Scotland). The Aston Villa midfielder's first-half hat-trick put Scottish nerves at ease. Always in the right place at the right time, McGinn was clinical and showed a real poachers instincts with each of his goals.
SCOTLAND: McLaughlin 5, Robertson 6, Findlay 7, Devlin 6, Palmer 7, McGregor 6, McTominay 7, McGinn 9, Forrest 8, Shankland 7, Christie 8 Subs: Russell 6, Armstrong, 7
SAN MARINO: Simoncini 7, D’Addario 4, Brolli 4, Censoni 3, Battistini 5, Mularoni 5, Golinucci 4, Gasperoni 6, Berardi 6, Giardi 5, Nanni 7 Subs: Grandoni 4, Hirsch 5, Ceccaroli n/a
12' - GOAL! Scotland 1-0 Spain. Scotland have lift off. Christie weaves his way into the box on the right-hand side, cuts in and looks to bend one into the bottom corner himself. It looks like it may just hit the post but McGinn nips in at gets the faintest of touches for the easiest of tap-ins to make it 1-0.
27' - GOAL! Scotland 2-0 San Marino. McTominay muscles his way in the box, turns on to his right foot and manages to get a shot away. It's a weak effort, but Simoncini makes a real mess of the save and just pokes the ball out to McGinn who swipes in for his second. Easy.
45+1 - GOAL! Scotland 3-0 San Marino. Findlay wins the header from the corner, knocks it goalwards and McGinn smacks home from two-yards on the turn. Game over.
65 - GOAL! Scotland 4-0 San Marino. Shankland with his first goal for Scotland! McTominay goes for goal from distance and strikes the bar. The ball falls for Shankland who passes into the empty net. A hint of offside from Shankland as McTominay went for goal...
67 - GOAL! Scotland 5-0 San Marino. Findlay on his debut! Yet another corner for Scotland and San Marino are all over the place at the back. Christie whips it in, Findlay heads in from three yards. Simple. It's raining goals at Hampden Park.
87 - GOAL! Scotland 6-0 San Marino. Armstrong gets in on the act with a marvellous free-kick from 25 yards. Top corner. Made all the more impressive that he managed to get the ball up and over the wall despite the puddle of water at his feet. Regardless of the opposition, no one's saving that.
John McGinn has become the first player to score a first-half hat-trick for Scotland since Lawrie Reilly against USA in a friendly in April 1952, 67 years and 166 days ago.