Odriozola's strike had sent the home side ahead in the 29th minute, but Rodriguez levelled in the 62nd minute following a mistake from Spain goalkeeper David de Gea as the spoils were shared in Villarreal.
Odriozola started at right-back for Spain, while Chelsea's Cesar Azpilicueta was in at centre-back alongside Gerard Pique, with Sergio Ramos unavailable due to his involvement in the Champions League final.
As for Switzerland, Stoke City's Xherdan Shaqiri started in a wide position, with Benfica's Haris Seferovic picked to lead the line. Stephan Lichtsteiner, meanwhile, captained the team from right-back.
David Silva was next to come close for the hosts in the 21st minute as the Manchester City attacker saw his low strike just miss the far post following a knockdown from Costa.
Switzerland's first opportunity of the game arrived in the 24th minute when Dzemaili found himself free at the far post, but the midfielder missed De Gea's crossbar.
Spain made the breakthrough in the 29th minute, and it came from an unlikely source as full-back Odriozola found the bottom corner of the Switzerland net with an excellent volley from outside the box.
Costa might have doubled Spain's lead late in the first period, but the Atletico Madrid forward headed a corner wide of the Switzerland post from close range, before Sommer denied the excellent Iniesta in the closing moments of the half.
Iniesta also tried his luck in the early stages of the second period, and the former Barcelona midfielder saw his low strike just whistle wide of the far post before being substituted in the 55th minute.
Switzerland were level just past the hour, however, when Rodriguez smashed home following a mistake from De Gea, who failed to deal with a weak attempt from Lichtsteiner.
Lucas Vazquez might have sent Spain back ahead 10 minutes from time, but the Real Madrid attacker saw his strike saved by the impressive Sommer.
La Roja continued to push for a second goal as the match headed for its final exchanges, and they came close to winning it through Nacho, whose curling effort clipped the outside of the post in the final minute, before the Real Madrid centre-back headed wide moments later.
Spain will complete their 2018 World Cup preparations against Tunisia next weekend, while Switzerland will take on Japan next Friday in their final match before this summer's tournament begins.
SPAIN (4-3-3): De Gea; Odriozola (Nacho 70'), Pique, Azpilicueta, Alba (Monreal 78'); Koke, Iniesta (Saul 55'), Thiago; D.Silva (Asensio 60'), Costa (Rodrigo 60'), Aspas (Vazquez 46')
SWITZERLAND (4-2-3-1): Sommer; Lichtsteiner (Lang 63'), Schar (Djourou 46'), Akanji, Rodriguez (Moubandje 78'); Behrami (Gelson Fernandes 63'), Zakaria; Shaqiri, Dzemaili (Embolo 46'), Zuber; Seferovic (Drmic 46')body check tags ::