Switzerland earned a 2-1 win over Spain in the Nations League on Saturday in Zaragoza to drag Luis Enrique's side off top spot in the group.
Portugal thrashed the Czech Republic 4-0 in the other League A Group 2 clash to move two points clear of Spain, whom they host on Tuesday in the final group match.
It was Spain's first defeat in the group in five games, and one which exposed their defensive frailty from set-pieces.
Manuel Akanji and Breel Embolo both scored from Switzerland corners, either side of Jordi Alba's strike.
"In two set-piece situations, which will be important at the World Cup, their goals arrived," said Villarreal defender Pau Torres.
"We have to improve on that."
Spain never looked comfortable in the game, a far cry from the team which reached the Euro 2020 semi-finals and were defeated on penalties by Italy.
As a result, they stumbled to their first loss on home soil since 2018, after 22 matches unbeaten.
Luis Enrique selected six Barcelona players in his starting line-up, including the regular midfield trio Xavi Hernandez utilises at Camp Nou, in Pedri, Gavi and Sergio Busquets.
Ferran Torres was another of the Barca clan, part of a three-pronged attack alongside Real Madrid's Marco Asensio and Paris Saint-Germain's Pablo Sarabia.
None of the three have enjoyed regular football with their clubs this season but were given Luis Enrique's trust.
They did not repay it in the first half, with Spain anaemic in attack and asleep at the back when it mattered most.
"We were sluggish, no, worse than sluggish," said Luis Enrique.
"We had the most imprecise first half of my reign as coach.
"(However) this defeat does not condition anything ahead of the World Cup, at all. It's always good to arrive in form to a World Cup, but I have total faith in the team."
Switzerland took the lead when Manchester City summer signing Akanji got the better of Cesar Azpilicueta in the air at a corner and nodded past Unai Simon in the 21st minute.
Spain struggled to create at the other end and Switzerland almost doubled their lead when veteran midfielder Xherdan Shaqiri cut through the defence and forced Simon into a smart save shortly before the interval.
The crowd grumbled, unimpressed at a drenched La Romareda stadium, in a city where Spain had not played since 2003.
Asensio had them out of their seats early in the second half when he created the Spain equaliser with an electric burst forward, before playing in Alba to finish clinically.
However, three minutes later Spain defended another corner poorly and Akanji's flick-on was nudged over the line by Embolo to restore the Swiss lead.
Defending set-plays was a serious issue for La Roja at Euro 2020 and it clearly remains one as the World Cup approaches.
Luis Enrique replaced his entire forward line, with debutant Borja Iglesias drawing huge applause at his former hunting ground, while Nico Williams also earned his first cap, a day after his older brother Inaki Williams made his debut for Ghana.
Athletic Bilbao forward Williams almost forced the equaliser when his cross was turned towards his own goal by Silvan Widmer, but Yann Sommer reacted quickly to keep the ball out.
The goalkeeper produced another solid save, punching away substitute Marcos Llorente's fierce drive as Spain began to threaten more.
Villarreal winger Yeremy Pino was bright on the right flank but even his spark fizzled out in the rain, and Sommer stayed alert until the end to deny Carlos Soler.
Luis Enrique's side, the 2021 Nations League runners-up, must now overcome Portugal in Braga to reach next year's finals.
"We have to beat Portugal now and make it to the final four," said Spain's goalscorer Alba, who has dropped behind Alejandro Balde and Marcos Alonso in the pecking order at Barcelona.
"I am grateful to the coach for keeping his confidence in me, and I just have to show that on the pitch."
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ