The night’s other League A Group 4 match saw Germany beat Ukraine 2-1 in Kiev.
At the Estadio Alfredo Di Stefano in Madrid, usually home of Real Madrid’s second string side, Real Sociedad striker Oyarzabal struck in the 14th minute.
The Swiss boldly tried to play out from the back, but Xhaka slipped as he sought to collect goalkeeper Yann Sommer’s pass.
Mikel Merino pounced and threaded the ball through to clubmate Oyarzabal, who finished superbly past Sommer.
There was a golden opportunity for Oyarzabal to double his tally in the 52nd minute.
Switzerland again struggled to clear their lines, Jesus Navas fizzed a cross-shot into the area which Sommer could only push into the path of Oyarzabal.
The striker’s effort, however, hit the post and went wide.
It was then the turn of Merino to scuff another prime chance. On the hour mark, a badly cleared corner fell to his unfavoured right foot and he shot high and wide directly in front of goal.
Sergio Ramos then saw an effort shielded away by Xhaka before a header went just wide moments later with Spain in the driving seat.
Switzerland thought they had an equaliser as Xherdan Shaqiri pivoted and sent the ball spiralling into the Spanish net.
But it was not to be as the referee handed Atalanta’s Remo Freuler a yellow card for a foul on Sergio Busquets in the build-up.
It was then the turn of Gerard Moreno to blast high after a smart twist and turn in front of the Swiss goal after a nice ball from Sergio Canales.
Luis Enrique’s side then contented themselves with seeing out the game, extending to 14 their current unbeaten run. They have also not lost in Madrid in 20 games dating back to 1987.
The Spaniards top their group, having kicked off with a creditable 1-1 away draw against Germany before a sparkling 4-0 victory over Ukraine, whom they now face on Tuesday.
In Kiev, Germany picked up a first win in their Nations League group with a workmanlike 2-1 away victory over the Ukrainians.
Defender Matthias Ginter gave Germany a first-half lead, then Leon Goretzka capitalised on a horrible mistake by the Ukraine goalkeeper before Ruslan Malinovskyi converted a late penalty for the hosts.
After drawing their opening Nations League games against Spain and Switzerland, then being held 3-3 by Turkey in a friendly on Wednesday, the win lifted Germany to second in the group behind Spain.
However, Germany can expect a much tougher task against the Swiss in Cologne on Tuesday and should have scored more having enjoyed around 75% posession against a weakened Ukraine side.
In the evening’s other games, Luxembourg beat Cyprus 2-0 and Montenegro eased past Azerbaijan by the same scoreline in Group 1 of League C.
In League D action, the Faroe Islands were held to a 1-1 draw at home against Latvia and Andorra fought out a goalless draw with Malta in Group 1 while Gibraltar edged Liechtenstein 1-0 in Group 2.