Teemu Pukki's goal 12 minutes from time stunned reigning world and European champions Spain who were held to a 1-1 draw by Finland in their Group I qualifier on Friday.
The hosts endured a frustrating first 45 minutes as they struggled to find a way through a camped Finnish defence, but they appeared on their way to victory when Sergio Ramos headed them in front on his 100th cap four minutes into the second-half.
However, they failed to build on their advantage and were made to pay when a good move from the Finns resulted in Pukki prodding home from close range.
The hosts were without the experienced trio of Iker Casillas, Carles Puyol and Xavi through injury so Ramos was also given the honour of captain for the evening.
However, the hosts didn't look like they would miss their veterans as they started brightly and were nearly gifted a goal inside two minutes when only a fine save from Niki Menp prevented Niklas Moisander turning David Silva's driven cross into his own net.
Thereafter though the first-half was tale of Spanish shots from distance as the visitors retreated onto the edge of their own area.
Cesc Fabregas was first to have a go as he curled a shot wide of the far corner before driving another effort just wide of the target.
Santi Cazorla then forced Menp into a decent low save with an angled drive, but the Arsenal midfielder should have opened the scoring when he blazed over from close range.
Silva and Andres Iniesta also went close with long-range effort towards the end of the half, but despite the return of David Villa from injury they were lacking the penetration needed to find a way through.
Vicente Del Bosque acted at half-time by bringing on Pedro Rodriguez, who had scored nine times in his last six internationals, for Cazorla.
The Barcelona winger had an immediate effect as his deflected shot from a short corner fizzed just wide.
And from the resulting corner Ramos rose highest to head in his ninth international goal.
Villa then failed to delight the home fans on his return to the city he started his career as his free-kick drifted over before he was replaced by Alvaro Negredo to rapturous applause.
Ramos came close again with a header that looped just over but Spain were stunned 12 minutes from time when a patient move saw Pukki get in front of Ramos and Gerard Pique to poke home Kasper Hamalainen's cross from the left.
Pique twice headed just off target and Juan Mata also flashed a volley over as the hosts laid a late seige.
However, the visitors held on to leave Spain most likely needing to win their next qualifier against France in Paris on Tuesday to avoid having to qualify for next year's World Cup via the playoffs.