Real Sociedad right-back Alvaro Odriozola volleyed Spain ahead on 29 minutes in Vila-real with a fantastic strike from the edge of the area in just his third international appearance.
Andrés Iniesta drew a sharp save from Yann Sommer at his near post before the break, and the veteran midfielder went close again early in the second half before he was replaced to a warm ovation ahead of his move to Japan.
AC Milan defender Rodríguez, whose father emigrated from Spain to Switzerland, levelled for Vladimir Petkovic's Switzerland, also World Cup bound, on the hour with a tap-in from close range after David de Gea palmed away an effort by Stephan Lichtsteiner.
Sommer then produced another fine stop to deny Valencia forward Rodrigo, while Nacho grazed the post with a curling strike late on as Spain's unbeaten run under Julen Lopetegui stretched to 19 matches.
“I'm happy on a personal level to have helped the team. We felt good out there, this match will help us to strike the right balance,” Odriozola told Spanish TV.
“If you had told me that (I'd have scored for Spain) a year and a half ago, I wouldn't have believed it,” said the 22-year-old who was playing for the Real Sociedad reserve team in the third division until 2017.
“That's life and that's football, it's the reward for working every day.”
Spain, the 2010 world champions, have one final warm-up game against Tunisia in Krasnodar next Saturday before their opening match of the tournament against Portugal on June 15.
They also face Iran in Kazan on June 20th and conclude their Group B campaign against Morocco in Kaliningrad five days later.
Switzerland take on Japan in Lugano next Friday ahead of flying out to Russia.
They play five-time World Cup winners Brazil in their first match in Group E on June 17th, with games to come against Serbia and then Costa Rica.