
Scotland lead the group with 15 points from their six games having endured defeat for the first time in the campaign, while Spain have 12 points from five matches and Norway 10 from six.
Scotland will qualify if Norway fail to win at home to Spain on Sunday.
The victory extends Spain’s winning run in home Euro qualifiers to 25 matches dating back to 2003, but they were frustrated for much of the night by some brave Scottish defence, though the loss after 44 minutes of captain Andy Robertson to injury was a blow for the visitors.
Scotland thought they had scored the opener midway through the second half when Scott McTominay netted from a freekick, but the goal was ruled out for offside.