Spain was in control from the start but couldn’t capitalize on its chances and paid the prize after a second-half blunder by goalkeeper David de Gea.
Alvaro Odriozola opened the scoring for the hosts with a neat volley from just outside the area in the 29th minute. Ricardo Rodriguez equalized for the Swiss in the 62nd after De Gea dropped the ball in front of goal while trying to hold on to a weak shot from inside the area.
The result kept Spain unbeaten in 19 matches since coach Julen Lopetegui took over after the 2016 European Championship.
Spain still wasn’t at full strength as defensive midfielder Sergio Busquets was dropped from the starting lineup after falling ill with gastroenteritis.
Real Madrid players also weren’t fully available after reporting late to the squad because of the Champions League final. Sergio Ramos, Francisco ”Isco” Alarcon and Dani Carvajal didn’t even travel for the match in Villarreal, although Nacho Fernandez, Marco Asensio and Lucas Vazquez were second-half substitutes.
Fernandez nearly scored Spain’s winner with a shot that hit the post in second-half injury time.
Lopetegui played with Diego Costa and Iago Aspas up front, while Jorge ”Koke” Resurreccion, Thiago Alcantara, Andres Iniesta and David Silva were in midfield.
Spain will head to Russia looking to rebound from early eliminations at the 2016 European Championship and the 2014 World Cup. La Roja won Euro 2012, the 2010 World Cup and Euro 2008.
Spain’s final warmup match will be against Tunisia on Saturday in Krasnodar, the team’s base in Russia.
Its first game at the World Cup is against European champion Portugal on June 15.
Spain will travel to Russia on Thursday.
More AP World Cup coverage: www.apnews.com/tag/WorldCup