Craig Levein’s side needed an unlikely win over the reigning world and European champions to guarantee them a play-off spot in Group I or at least match Czech Republic’s result in Lithuania.
However, a first-half double from David Silva was a testament to the home side’s superiority – and the Czechs streaked into a three-goal interval lead themselves.
David Villa netted Spain’s third goal in the 54th minute to end any semblance of a contest before Scotland substitute David Goodwillie scored a consolation goal from the spot after Victor Valdes had fouled Craig Mackail-Smith.
However, with the Czech Republic completing a 4-1 win over Lithuania, it was all over for the Scots.
Mackail-Smith passed a fitness test on a back problem and was chosen to lead the line again as Levein kept the same starting XI.
Skipper Darren Fletcher overcame an ankle knock while fellow midfielder Barry Bannan played with a strapping on his Achilles injury.
The world and European champions were looking for a perfect qualification campaign and included star names such as Silva, Xavi and Villa – although Fernando Torres was dropped to the bench.
A huge travelling support gave the Scots encouragement but, as expected, Spain kept the ball almost from the first whistle as the visitors chased shadows.
It took only six minutes for Spain to take the lead from an attack down the left, Villa setting up defender Jordi Alba – who cut the ball back for Silva to sweep the ball low past goalkeeper Allan McGregor.
Scotland stuttered then responded and moments later Bannan’s cross from the right to the far post just evaded the stretching Steven Naismith.
In the 12th minute, as Spain reasserted themselves, midfielder Santi Cazorla drove at the Scots defence before sending in a low drive which McGregor grabbed at the second attempt, moments before the Rangers man made another save, this time from Pedro’s shot.
Scotland had their best chance of the half when Naismith’s backheader found Fletcher – but the Manchester United midfielder volleyed over from 12 yards.
McGregor had to dive low to his right to tip a powerful drive from Villa away for a corner, which the Scots survived.
Four minutes from the break the Rangers keeper made a great save from Cazorla, but with a minute remaining Silva worked a one-two with Pedro before driving low past McGregor for Spain’s second goal.
Mackail-Smith had a snapshot at the start of the second half which went straight to Spain goalkeeper Victor Valdes – but it was simply a precursor to more misery for the Scots.
Moments later Naismith gave the ball away deep in defence, allowing Pedro to set up Silva for a shot which went high and wide.
In the 54th minute the Scottish defence was cut open again and this time Silva set up Villa who, from 14 yards, calmly slotted the ball past McGregor for number three.
Just past the hour mark Bannan had an effort from the edge of the box easily saved by Valdes, before McGregor made yet another save from Villa.
In the 66th minute, Scotland were awarded a penalty when Valdes fouled Mackail-Smith and substitute David Goodwillie scored his first international goal from the spot.
Six minutes later Goodwillie had a great chance to set up an exciting finish when Alan Hutton knocked on a McGregor goal-kick – but the Blackburn striker’s shot went over the bar.
However, Spain finished as they started and they almost got a fourth goal in the 83rd minute when Cazorla’s chipped shot over McGregor landed on the roof of the net.