Villa breaks Raul's La Roja record after converting penalty...Spain edged Scotland in a classic qualifier that saw the home side come back from two goals to set up a frantic finale.
The home side slipped up just moments before the break to concede a penalty that David Villa duly converted and Andres Iniesta added another after half-time to put the Scots seemingly out of touch until Steven Naismith netted his first international goal moments later and Gerard Pique turned in a James Morrison cross to level the score.
Substitute Fernando Llorente volleyed beyond McGregor to restore the lead with just over 10 minutes remaining and Steven Whittaker, who saw yellow for handling in the box to give away the penalty, was sent off late on for a second bookable offence.
Craig Levein dropped his controversial strikerless formation following Scotland's defeat in Prague on Friday night, with Kenny Miller returning to the starting line-up while Lee McCulloch returned from suspension to start in midfield and full-back Phil Bardsley was handed his international debut.
For the reigning world and European champions, playmaker Xabi Alonso started after recovering from flu to play in the middle of the park alongside the Barcelona duo of Sergio Busquets and Iniesta, as Santi Cazorla continued to play in an advanced central role in the absence of Liverpool striker Fernando Torres and Sevilla winger Jesus Navas.
The home side sought to maximise their home advantage and swiftly earned a corner as Hampden Park rocked, but the visitors soon settled into their customary comfortable ways, holding onto the ball with ease from back to front but the first effort of the game, a wild left-footed effort from the edge of the area from David Silva, epitomised the blunt start to the game.
Real Madrid defender ought to have done better after finding himself on the overlap, but despite having virtually walked the ball to the byline under little pressure, the former Sevilla man failed to pick out a man after being blocked off by Graham Dorrans.
That sight of danger, and the ease with which the world champions were able to find themselves in such a position, was soon followed by a more clear cut opportunity as Alonso fed through a ball to Villa, but the Barcelona forward failed to hit the target.
He would, however, work Allan McGregor just minutes later after leaping high to a Silva cross, but the Rangers stopper had his near post well covered, and was soon called into action to deny Silva with his feet after the Spanish slowly pulled apart the Scottish backline with a neat move.
That flurry of activity in front of goal woke up the home side who had hitherto appeared happy to stand back and admire the tiki-taka play of their opponents. A sweeping, sudden attack saw Darren Fletcher slide the ball from the byline to James Morrison, who had galloped into the box unmarked, but the West Brom midfielder saw his effort blocked in the six yard box before Carles Puyol booted clear under pressure.
The Scots, perhaps inspired by the Swiss side that caused the upset of the World Cup in South Africa, sat back and looked to plug the gaps whenever the world champions saw the ball in their half, with only one man at a time ever committing to harry the ball carrier. The tactic forced the Spaniards wide in possession, and Ramos should have done more when an Iniesta cross found him the right side of Steven Whittaker, but the 24-year-old could not steer his effort towards the target.
Despite the efforts to stymie, the visitors remained undeterred and continued their patient probing ways, engineering a chance for Villa after Silva weaved into the box and saw a shot blocked. The loose ball fell at the feet of the impish striker who, with his back to goal, spun round and saw a sweeping left-footed strike tipped away by the alert McGregor.
Whilst the Scottish backline might have been able to prevent passes going between them on the ground, they could do little but watch as Alonso lifted a through ball over their heads to Silva, who, free of any marker, failed to control as McGregor rushed out.
The Manchester City attacker saw another sight of goal on the 40 minute mark as he was forced inside from the right and hit a skimming shot with his left boot that McGregor again had comfortably covered.
Aside from Morrison's effort, the Tartan Army had little to cheer in the first half as their side saw little of the ball due, in no small part, to the constant pressing of the three Spanish attackers, and when the home fans were on their feet they were soon back on their seats in frustration as Kenny Miller failed to pick out Dorrans with the West Brom man racing through on goal.
The Spanish immediately punished the sloppy pass as a Ramos volley - almost certainly going wide of goal - was blocked by the arm of Whittaker, who stood scarcely a metre away from the Madrid man. Up stepped Villa to coolly slot into the far corner and put himself ahead of Raul as La Roja's all-time top scorer.
It was the last act of a first half that was almost completely controlled by the Spaniards, but a dogged defensive display had kept it close until Whittaker's handball.
The world champions are as revered for their control of games as they are for their stoic defensive record, and it would have to take something special for Scotland to prise open such a resolute defence.
The home side started the second in the same manner as they did the first, and again their early corner amounted to nothing and an awkward volley from substitute Charlie Adam, a half-time replacement for McCulloch, flew harmlessly wide.
McGregor was soon called into action to yet again deny Silva, this time as the former Valencia attacker chested down a cross in space and hit a flying volley to the far post.
That chance saw the Spanish settle into their rhythm once more and, after Cazorla headed wide from a Ramos cross, it was the man who scored the World Cup winning goal that added a second following an Alonso through ball to Joan Capdevilla, whose shot rebounded into the path of Iniesta for an easy finish.
But that did not deter the home side who quickly went up on the attack and narrowed the margin through Naismith, who headed in for his first senior international goal after a measured Miller cross split Pique and Puyol.
Incredibly, after being down and well and truly out after Iniesta's strike, the home fans would soon be elated after clever play from Fletcher saw Morrison free down the inside right and his cross was disastrously turned in by Pique as Iker Casillas looked on in horror.
After a remarkable turn around in just eight minutes of play, Vincente del Bosque almost immediately made his first change, replacing Cazorla with the Valencia winger Pablo Hernandez.
The man who set up the first of Scotland's goals then found himself in the referee's book for a rash studs up challenge on Alonso that saw the former Liverpool midfielder caught on the knee.
McGregor, arguably the best player on the pitch, made another adept save with his feet to deny Capdevilla and to keep the scores level as the Spanish threw men forward with 15 minutes remaining.
With Scotland on the up, Morrison went for the spectacular in an attempt to give his side the lead from the halfway line as Casillas scurried back to his goal-line, but his effort bounced wide.
That effort was followed by the substitution of Silva for the big target man Fernando Llorente, and the Athletic Bilbao man soon put his side ahead after directing a whipped Capdevilla cross, on the volley, beyond McGregor.
Based on overall play, it was a goal that gave the Spaniards a deserved lead, but the manner in which Scotland came back from a two goal deficit earned respect, and until Whittaker's late second yellow, the home side continued to threaten.