Costa, 27, was sent off during his club's 2-0 FA Cup quarter-final defeat at Everton last week, ruling him out of Saturday's game with West Ham.
Chelsea boss Guus Hiddink said on Friday that Costa has a problem with a tendon in a hip muscle.
Spain are away to Italy in Udine on 24 March before facing Romania in Cluj three days later.
Athletic Bilbao forward Aritz Aduriz, 35, has replaced Costa as Vicente del Bosque's squad build-up to this summer's European Championships in France.
Aduriz has scored 17 goals in 28 La Liga games this season.
The Spain squad features six Premier League players.
Manchester United goalkeeper David de Gea and midfielder Juan Mata are included along with three Chelsea players - defender Cesar Azpilicueta, midfielder Cesc Fabregas and winger Pedro.
Manchester City midfielder David Silva is also named.
Goalkeepers: Iker Casillas (Porto), David de Gea (Manchester  United), Sergio Rico (Sevilla).
Defenders: Jordi Alba, Gerard Pique, Marc Bartra (all Barcelona), Sergio Ramos, Nacho (both Real Madrid), Cesar Azpilicueta (Chelsea), Juanfran (Atletico Madrid), Mario Gaspar (Villarreal).
Midfielders: Sergio Busquets, Sergi Roberto (both Barcelona), David Silva (Manchester City), Mikel San Jose (Athletic Bilbao), Koke (Atletico Madrid), Cesc Fabregas (Chelsea), Thiago Alcantara (Bayern Munich), Isco (Real Madrid), Juan Mata (Manchester United).
Forwards: Pedro Rodriguez (Chelsea), Alvaro Morata (Juventus), Aritz Aduriz (Athletic Bilbao), Paco Alcacer (Valencia), Nolito (Celta Vigo).
Chelsea striker Diego Costa has been left out of Spain's squad for friendlies against Italy and Romania.