Scotland's Euro 2012 qualifying campaign ended in failure as they lost heavily to Spain in Alicante.
A first-half brace from David Silva and a third from David Villa meant David Goodwillie's 66th-minute penalty was of little consolation to travelling fans.
The Scots finish Group I in third place with 11 points from eight fixtures.
The Czech Republic's 4-1 win over Lithuania means they go into Thursday's play-off draw at the expense of Craig Levein's side.
Scotland's coach had named an unchanged line-up for their final fixture, with Craig Mackail-Smith again playing as a lone striker in a 4-1-4-1 formation.
Spain, meanwhile, made six changes, among them goalkeeper Iker Casillas being rested in favour of Victor Valdes and Fernando Torres replaced by Villa up front.
And the world champions were immediately in control, with Scotland failing to get a touch of the ball in the opening two minutes of play.
Seconds later, news filtered through from Lithuania that the Czech Republic had gone a goal up through a Michal Kadlec penalty as they headed for a win that would mean Scotland had to defeat the world champions to prevent the Czechs taking second place in the group.
That task was made harder in the sixth minute, when Jordi Alba, making his debut for Spain, sent in a cross from the byline that found Silva, who drove the ball under goalkeeper Allan McGregor from 10 yards.
A shell-shocked Scotland had the chance to respond two minutes later when Steven Naismith was on the end of Barry Bannan's cross in from the left, but the angle was too difficult for the Rangers striker to hit the target.
McGregor saved from Santi Cazorla and Pedro as Levein's side were not allowed to settle with wave after wave of attack from the Spaniards.
News after 18 minutes that the Czech Republic had gone 2-0 up in Lithuania only served to make Scotland's efforts appear all the more futile.
There were further chances for Cazorla and Carlos Puyol, before Naismith was again frustrated in front of goal by a well-timed Gerard Pique challenge.
A Naismith flick set up his captain, Darren Fletcher, but the Manchester United midfielder sent his drive over the crossbar from 16 yards.
However, Spain continued to coolly dictate the game and their patience paid off just before half-time.
Silva darted from the halfway line to the edge of McGregor's box then casually exchanged a one-two with Pedro before slipping a left-footed shot past McGregor.
Scotland's strategy after the break was clear when McGregor fired the ball across the length of the pitch to Mackail-Smith, whose right-footed shot from 20 yards out was on target but straight into the hands of Valdes.
While Scotland hit and hoped, Spain continued to craft and their third was a collaboration between Silva and Villa.
The Manchester City midfielder surged through the Scotland defence before unselfishlessly holding up the ball in anticipation of Villa's run, the Barcelona striker slotting home for his 50th international goal.
With the deficit growing, Levein introduced Goodwillie as an additional striker and the Blackburn Rovers player was called into action almost immediately when Mackail-Smith was upended by Valdes having pounced upon a loose ball.
Goodwillie slotting home from the spot, but any lingering hope of a Scotland comeback died when he drove high and wide with 10 minutes left rather than play in the well-positioned Mackail-Smith as Spain finished their qualifying campaign with a 100% record.
Spain: Valdes, Sergio Ramos, Puyol (Arbeloa 46), Pique, Jordi Alba, Xavi (Llorente 64), Busquets, Silva (Thiago 55), Santi Cazorla, Villa, Pedro. Subs Not Used: Casillas, Javi Martinez, Torres, Mata.
Booked: Sergio Ramos.
Goals: Silva 6, 44, Villa 54.
Scotland: McGregor, Hutton, Berra, Caldwell, Bardsley, Morrison, Fletcher (Cowie 85), Adam (Forrest 63), Bannan (Goodwillie 63), Mackail-Smith, Naismith. Subs Not Used: Marshall, Whittaker, Robson, McManus.
Booked: Fletcher, Goodwillie, Morrison.
Goals: Goodwillie 66 pen.
Ref: Stefan Johannesson (Sweden).