Lawrence Shankland and Stuart Findlay both netted their first international goals during a second half which was played in terrible conditions. Stuart Armstrong made it six after a bizarre incident in the latter stages.
The ball held up with every pass in the second half, with the heavy rain continuing throughout the game. A domestic match would unquestionably have been abandoned in similar circumstances but neither team nor the French match officials were looking to try again 24 hours later, as UEFA rules dictate.
While there was a limit to what can be taken from beating the world's lowest ranked team on such a pitch, Scotland did move up to fourth spot in Group I of the European Championship qualifiers. With Cyprus and Kazakhstan both losing, Scotland are now a point off third ahead of playing both teams next month, and have a chance to boost morale before the play-offs in March.
Steve Clarke made six changes following Thursday's 4-0 defeat in Russia, Scotland's fourth loss in succession. Sunderland goalkeeper Jon McLaughlin won his second cap, Kilmarnock defender Findlay made his debut, Scott McTominay returned from suspension, Celtic midfielders Ryan Christie and James Forrest were recalled, and Shankland made his first start up front.
Scotland forced six corners inside the first nine minutes but both McTominay and Michael Devlin failed to get headers on target.
Shankland also had a good early chance from James Forrest's cutback but San Marino goalkeeper Aldo Simoncini pulled off an outstanding stop.
The opener was not long in coming though as McGinn got a deft touch on Christie's 12th-minute shot following Andy Robertson's diagonal ball.
McGinn's second came in the 27th minute after Simoncini could only palm McTominay's driven ball into his path eight yards out.
The hat-trick came in first-half stoppage-time from Scotland's 13th corner. Findlay headed Christie's delivery towards goal and McGinn turned and finished inside the six-yard box.
Simoncini had earlier made another stunning stop from McTominay after another cutback from Forrest, who also forced two decent first-half saves.
The conditions deteriorated badly in the early stages of the second half with simple passes soon getting stuck in the surface water.
The game was fast becoming a farce when two of Scotland's latest additions celebrated their first goals.
Shankland rolled the ball home from 12 yards after McTominay's strike cracked off the bar in the 65th minute, and Findlay headed home Christie's corner from close range two minutes later.
McGinn was looking to become the first Scotland player to hit four in a game since Colin Stein in 1969, and he forced a save from long range just before being taken off in the 70th minute.
Johnny Russell had a shot stopped before fellow substitute Armstrong benefited from a misunderstanding in the 87th minute.
The San Marino goalkeeper picked the ball up outside his box after Shankland appeared to be fouled in the centre circle. The referee had waved play on though and Scotland found themselves with a free-kick 25 yards out.
Some of the San Marino players urged Scotland to give them the ball back but Armstrong showed no such generosity and curled into the top corner.