McTominay made no such mistake six minutes after the restart, however, drilling a fine volley with the left foot after excellent work from Kieran Tierney.
Spain applied late pressure but failed to create many clear chances as Scotland enjoyed the cheers of a raucous crowd in Glasgow.
The defeat is a serious early blow for Spain’s new coach Luis de la Fuente, who took over from Luis Enrique following a World Cup last-16 exit in Morocco.
“It’s clear that the two chances they had, they squandered away and we tried, we hit the woodwork twice, we had a lot of chances,” Spain midfielder Rodri told Teledeporte.
“We have to correct these lapses, and those things that cost us against these teams.”