Costa, who holds Brazilian and Spanish passports, has written to the Brazilian Football Confederation stating he wants to represent the world champions.
Brazil coach Luiz Felipe Scolari said recently he planned to select the 25-year-old for friendlies in November.
Costa played for Brazil in March - but only in friendly matches, and so could switch allegiances.
In a statement, the Spanish Football Federation said that the player has stated "his desire to be at the disposition of the Spanish national team manager Vicente del Bosque" in a signed letter addressed to Julio Cesar Avelleda, secretary general of the Brazilian Football Confederation.
This season, Costa has been in superb form for Atletico - the club he has been with since 2007 - and is the top scorer in La Liga with 11 goals after 10 matches.
"I hope people understand and respect my decision because it has been very difficult," he said.
"It was very difficult to choose between the country where you were born and the country that has given you everything.
"I looked at everything and saw that it was right and best to play for Spain because this is where I have done everything. All that I have in my life was given to me by this country."
"I hope people understand because it is not something against Brazil," he added.
"I have family in Brazil and it is the country where I was born. I hope that God allows me to live there again in the future."
Should he be selected, he could make his Spain debut on 19 November in a friendly against South Africa.

The four-time champion has been at the team since 2015 and has helped build them up to be title contenders this year after a difficult few seasons.
Vettel is leading the championship by 14 points from Mercedes driver Lewis Hamilton with nine races remaining.
The move ends speculation that the 30-year-old could be considering a move to Mercedes in the near future.
A statement from Ferrari said the team had "extended its technical and racing agreement" with Vettel "for the 2018, 2019 and 2020 racing seasons of the F1 world championship".
In Ferrari's time-honoured style, the statement contained no quotes or further information from the driver or the team.
Ferrari announced earlier this week they had retained Vettel's team-mate Kimi Raikkonen for one more season.
Vettel had made it clear his preference was for the Finn to stay.
Vettel's decision is likely to be followed by confirmation from Mercedes that they will retain Valtteri Bottas for at least another season alongside Hamilton.
The Finn was signed on a one-year deal to replace world champion Nico when after the German retired from F1 after winning the title last year.
Hamilton is contracted to Mercedes until the end of 2018.
Later, after qualifying second to title rival Lewis Hamilton's Mercedes, Vettel said: "I love this team and the people who work for this brand," adding: "In a way, it was a no-brainer to continue. We haven't yet achieved what we wanted to achieve. But things are looking pretty good and obviously we have a long road ahead of us."
Asked whether he had talks with Mercedes over the summer, he said: "I have been around in the paddock for a while so I know people and it's only natural you talk, but it has never been more than chatting," he said. "I have been talking for a while with Ferrari. My intention was to stay."
Mercedes F1 boss Toto Wolff said: "There were zero discussions with Sebastian about a contract."
Vettel added that he had signed the deal at this weekend's Belgian Grand Prix and talked of the inspiration he has following in the footsteps of his childhood hero Michael Schumacher.
"We haven't succeeded. The mission is still ongoing. I want to win in red. We talked about inspiration earlier, about Michael, who was mostly dressed in red, he won most of his races and championships in red.
"I don't want to step in his footsteps. The whole generation of the Ferrari team today was to leave their own footsteps but certainly there is a huge inspiration. Something that for me is now the biggest challenge and dream I have. It's what I want to achieve."
Atletico Madrid's Brazil-born forward Diego Costa has confirmed his intention to play for Spain.
[NEXT_CONCEPT]
Sebastian Vettel has signed a new contract to stay with Ferrari until the end of 2020.