"The player communicates in the letter addressed to Julio Cesar Avellada, secretary general of the Brazilian football federation (CBF), his wish to be available to the Spanish national team," the Spanish federation (RFEF) said on its website (www.sefutbol.com) on Tuesday.
Costa's commitment to Spain on Tuesday prompted an angry reaction from Scolari as he withdrew the player's invitation to take part in the two friendlies in a statement posted on the CBF website (www.cbf.com.br).
"A Brazilian player who refuses to wear the shirt of the Brazilian national side and take part in the World Cup in his own country must automatically be uninvited," Scolari said.
"He is turning his back on the dream of millions, the dream of representing the five-times world champions at the World Cup in Brazil."
The president of the CBF, Jose Maria Marin, refused to accept Costa's decision and said at a news conference he would "use every legal means possible" to ensure the player could not represent Spain.
"Brazil is going to fight to the end," he said. "This is not over."
However, Scolari's assistant Carlos Alberto Parreira appeared resigned to losing out to the Spanish and said Costa would not be called up again.
"We tried everything," Parreira told reporters. "But I wouldn't call him up again. For me, the matter is now closed."
Costa's first chance to feature for Spain could come on Nov. 19 when they play South Africa in a friendly at Soccer City in Johannesburg, scene of their maiden World Cup triumph in 2010.
He represented Brazil in friendlies against Russia and Italy in March but was left out of the squad for June's Confederations Cup and is not tied to one country until he has played in an official competitive game.
Tall and powerful in the air, Costa has an excellent touch and vision and is always a handful for opposition defences who find it tough to cope with his physical approach that sometimes pushes the boundaries of fair play.
His first clubs in Europe were in Portugal and he moved to Atletico from Braga in 2007 before passing through Celta Vigo, Albacete, Real Valladolid and Rayo Vallecano, the club where he scored 10 goals in 16 La Liga appearances in 2011-12.
Last season Costa was instrumental in Atletico's triumphant Copa del Rey campaign, scoring his eighth goal in eight appearances in the 2-1 win over Real Madrid in the final.
He will face stiff competition for a place in Del Bosque's squad for next year's World Cup in Brazil from the likes of Alvaro Negredo, Fernando Torres, David Villa, Roberto Soldado and Fernando Llorente.