Costa was forced out of Saturday's Champions League final, which his side, Atletico Madrid, lost 1-4 to Real Madrid after just nine minutes of the game, reports Xinhua.
He also had to leave the field in the first half of Atletico's final Primera Liga game in which they sealed the Spanish league title with a 1-1 draw away to Barcelona.
The striker underwent tests at the Clinico Centro in Madrid and the clinic's director, Pedro Guillen, confirmed the striker needed to "rest for at least two weeks".
"He has small muscle tear .. maybe he won't be there," added the doctor.
Spain kick-off their title defence June 13, in just 18 days, meaning Costa may or may not have recovered from his injury in time to take his place in the line-up for the match against 2010 runners-up The Netherlands.
Spanish coach Vicente del Bosque will finalise his 23-member squad after the friendly against Bolivia slated for Friday. The 23 players will travel to the US to train before arriving in Brazil.
If Costa fails to make the cut, he would be replaced by either Fernando Llorente or Alvaro Negredo.