Goals from Alvaro Morata and Oihan Sancet consigned Steve Clarke's men to a first defeat of their qualifying campaign, although Scotland leave Seville feeling aggrieved.
Manchester United midfielder Scott McTominay thought he'd broken the deadlock against Spain as his free kick beat everyone, flying straight into the top right hand corner.
But joy quickly turned to frustration for McTominay as the goal was ruled out by VAR.
Jack Hendry, who was stood by Spain goalkeeper Unai Simon, was adjudged to be offside.
As McTominay saw his goal had been chalked off, he launched his bottle on the ground.
READ MORE PREMIER LEAGUE
Liverpool and Scotland face blow as Robertson forced off injured during Euro qualifier
Everton chairman Bill Kenwright has cancerous tumour removed from liver
Speaking afterwards, manager Steve Clarke said: "They have made the call, there is no point me going on about it.
"I think there was a little bit confusion at the time, whether it was offside or for a foul on the keeper.
"If you take those two together, Jack Hendry was marginally offside and when he steps towards the goalkeeper they have interpreted that as Jack being involved in the play but I will tell you now there is now way in the world the keeper was saving that no matter where Jack Hendry was.
"You just move on, it is a VAR decision that goes against you."
Most read in Football
Sheepish Rodri backtracks on infamous Scotland comments after boos from Tartan Army
Chelsea wanted stadium with chimneys but it became shops and 'cathedral' plan was ditched
England vs Australia build-up, Spurs claim Premier League awards double
Liverpool and Scotland face blow as Robertson forced off injured during Euro qualifier
McTominay's effort would've put Steve Clarke's men 1-0 up and if the game finished like that, it would've guaranteed their place at Euro 2024.
A few minutes later, salt was rubbed into Scotland's wounds as Alvaro Morata put the home side a goal up on 73 minutes.
But as the Scots hoped for an equaliser, their evening got even worse.
Aaron Hickey slipped on the left of Scotland's box despite being under no pressure and was quickly pickpocketed by Joselu.
The Spaniard sent in a cross for the on-running Sancet to make it 2-0.
Group A opponents Norway's 4-0 win over Cyprus and no win for Scotland means Steve Clarke's side will have to wait for qualification until another day.
If Norway fail to beat Spain on Sunday then Scotland's place in Germany will be sealed.
Scotland had won their previous five European qualifiers before Thursday's defeat.