After coming off the substitutes' bench to net two goals in the final six minutes of Saturday's 3-0 win over Cyprus, McTominay was rewarded with a start against La Roja and opened the scoring in the seventh minute with a strike inside the penalty area.
The Manchester United midfielder then doubled his and Scotland's tally six minutes after the restart, and Steve Clarke's men eventually held on to claim a deserved win and their first over Spain for 39 years.
Scotland have moved to the top of Group A after winning their opening two matches, while Spain - who beat Norway 3-0 on Saturday - have slipped to second place after seeing their 19-game unbeaten run in Euro qualifiers brought to an end in Glasgow, with Luis de la Fuente losing his first game in charge since replacing Luis Enrique at the end of last year.
Following a rousing rendition of the Scottish national anthem, Clarke's side came out the blocks quickly against Spain, in start contrast to their encounter against Cyprus in which they initially struggled to get going.
Scotland skipper Andrew Robertson capitalised on a slip from Pedro Porro on the right side of Spain's penalty box before cutting the ball back from the byline for McTominay to slot a deflected strike beyond Kepa Arrizabalaga.
The Tartan Army were whiskers away from doubling their lead on the 15-minute mark when Ryan Christie pokes a low-driven strike narrowly wide of the far post after receiving a nicely-timed through-ball from John McGinn.
Spain appeared to be rattled by Scotland's bright start, but they eventually grew into the game and enjoyed a spell of dominance with the ball, with Espanyol striker Joselu - starting his first international match - coming close with two headers within the space of three minutes.
Joselu's first effort was comfortably saved by Angus Gunn before the 33-year-old crashed a header onto the crossbar after Aaron Hickey had put Scotland's number one in danger with a poor back-pass moments earlier.
De la Fuente's men were knocking on the door, with two looping headers from Rodri followed by a long-range effort from Porro that required Gunn to tip over the crossbar.
Tempers were running high towards the end of the half with Robertson and Lyndon Dykes both booked for late challenges, before Joselu saw an appeal for a penalty waved away even though Ryan Porteous appeared to have a fist full of the Spaniard's shirt.
Dykes then came agonisingly close to scoring Scotland's second when he prodded the ball just over the crossbar after chasing down a long ball over the top from Robertson.
Clarke will have rued that late chance on the stroke of half time, but his Scots side made no mistake when presented with an opportunity just six minutes after the break, as McTominay continued his fine run of form in front of goal by netting his second of the night in stunning fashion.
After Kieran Tierney bombed down the left flank, comfortably brushing off the tame defensive efforts of substitute Dani Carvajal, the Arsenal left-back fired a cross into the penalty box which pinged off the thigh of David Garcia, perfectly setting up McTominay to fire home a first-time volley into the bottom corner.
McTominay has become the first Scotland player to score a brace against Spain since Mo Johnston in a 3-1 victory back in November 1984 in a World Cup qualifier.
Signs of frustration were evident from Spain, who struggled to create any real clear-cut chances, and the final 15 minutes was virtually a non-event, which suited Scotland as they managed to see the game out to claim three valuable points in front of a jubilant Hampden Park crowd.
Scotland are next in action when they travel to Norway for a Euro 2024 qualifier on June 17, while Spain are scheduled to face Italy in the UEFA Nations League semi-finals held in the Netherlands two days earlier.