Real Sociedad forward Mikel Oyarzabal scored the only goal early in the first half.
Wolverhampton Wanderers’ Adama Traore made his competitive debut for Spain, while Liverpool’s Xherdan Shaqiri came on for Switzerland after being passed fit following a negative Covid test.
David de Gea’s clean sheet capped a satisfying night for the home side.
De Gea, who replaced Chelsea’s Kepa Arrizabalaga, was forced into a smart early save by Loris Benito, palming away the Switzerland wing-back’s low shot at his near post.
But any confidence the visitors may have taken from that early sight of goal seemed to be snuffed out in the 14th minute when some inexplicable play in their own penalty area was punished by Oyarzabal.
A sloppy short pass from goalkeeper Yann Sommer was intercepted by Mikel Merino, who set up the forward for a simple finish and his third international goal.
Sommer went some way to making up for his error with a decent save in the 28th minute, turning away a powerful downward header from Manchester City’s £20m winger Ferren Torres.
Oyarzabal missed a glorious chance to double his tally shortly after the break when the Swiss goalkeeper palmed a shot into his path, but he was unable to react quickly enough to turn the ball in at the back post.
Barcelona’s teenage attacker Ansu Fati had an uneventful night and was replaced by 24-year-old Traore.
Germany won 2-1 in Ukraine in the other match in Group A4 to remain two points behind Spain after three matches.
Home TeamSpainAway TeamSwitzerlandPossessionHome60%Away40%ShotsHome12Away4Shots on TargetHome2Away1CornersHome8Away3FoulsHome10Away11