The Atletico Madrid forward, who holds both Brazilian and Spanish passports, featured in friendly matches for the Selecao last year.
Brazil coach Scolari had confirmed his intention to select the 25-year-old for further friendly games but Costa, who passed a medical ahead of a £35million move to Chelsea on Wednesday, decided to switch allegiances before then.
Costa will now travel to the World Cup as part of the Spain squad after a prolific season with his club side Atletico.
And the striker has revealed that coach Vicente del Bosque played a key role in convincing him to commit his future to La Roja – something he says Scolari never attempted to do.
"Scolari has never called me by phone,” Costa told Brazilian TV channel Globoesporte.
“The only coach with whom I have spoken is with Del Bosque, who cared for me, invited me to lunch and made me realise that I was in his plans.
“I'm Brazilian and this will not change, but I want to win the World Cup with Spain. Physically, I'm fine but I want to play.”
Spain open up their World Cup campaign against the Netherlands in Salvador on June 13.