Northern Ireland's Euro 2008 qualification hopes fizzled out last night as a deflected Spain goal condemned them to defeat in Gran Canaria.
Xavi's fortuitous second-half strike brought Northern Ireland's dreams to an end while Sweden beat Latvia 2-1 to rule out the Province's hopes anyway.
The Northern Irish ended their thrilling campaign on a relative low, with Xavi's long-range drive careering off Sammy Clingan's head to wrong-foot Maik Taylor.
An unlikely victory in Gran Canaria, combined with Latvia beating Sweden, would have secured Northern Ireland a place at Euro 2008 and ended their long absence from a major finals.
Manager, Nigel Worthington, made two changes to his side as they faced their night of destiny. Chris Baird and Ivan Sproule returned as Jonny Evans and Keith Gillespie were both suspended.
Northern Ireland's hopes rested mainly with the striker David Healy, who was looking to improve on his record 13-goal tally in the qualifying campaign.
The Ulstermen had incredible backing for this crucial fixture more than 4,000 supporters made the trip.
Spain started brightly and Xavi cracked a shot wide of Taylor's post after two minutes.
The home side had loud claims for a penalty waved away by the referee Herbert Fandel in the seventh minute after David Silva went to ground following a challenge from Stephen Craigan.
Spain stepped up the pressure and Taylor got down quickly to smother a shot from Daniel Guiza.
Cesc Fabregas sprang into life after 38 minutes and the Arsenal midfielder stung Taylor's fingers with a rasping drive from 20 yards.
The home crowd, though, were becoming a little bit frustrated by their team's inability to break the deadlock despite some neat play.
Spain went ahead in the 53rd minute with Northern Ireland cursing their luck. Taylor seemed to have Xavi's 25-yard effort covered but he was left wrong-footed after it took a deflection of Craigan.
Spain should have extended their lead two minutes later when substitute Joaquin pulled the ball back from the byline. It looked a tap-in for Silva but he somehow managed to steer his shot wide of Taylor's post.
The Irish refused to give in and Healy received a booking for a late challenge on Sergio Ramos. Taylor then had to be sharp off his line to thwart the onrushing Joaquin five minutes from full time as the Spaniards looked to kill of the game.
Spain (4-4-2): Reina; Sergio Ramos, Albiol, Pablo, Pernia; Iniesta, Xavi (Villa, 67), Fabregas (Joaquin, 47), Senna; Silva, Guiza (Tamudo, 57). Substitutes not used: Casillas, Puyol, Albelda, Riera.
Northern Ireland (4-4-2): Taylor; McAuley, Craigan, Hughes, Baird; Sproule (Robinson, 61), Clingan, Davis, Brunt (Lafferty, 59); Healy, Feeney (Paterson, 72). Substitutes not used: Mannus, Webb, Capaldi, Hamilton.
Referee: H Fandel (Germany)