The Atletico Madrid man, who netted 36 goals in all competitions in 2013/14, has struggled for fitness after suffering a hamstring injury in early May.
He was forced off early in the recent Champions League Final, but is now back in contention.
"Diego will play against El Salvador," said Spain coach Vicente Del Bosque.
"He had a good training session and felt good. We want him to play and check how he feels, especially after a while since the last time he played a complete match.
"If we thought that there was a risk for Diego Costa playing then we would not use him. We think that he's fine, his medical situation is done, he's ready so we want him to play."
Spain will start their World Cup title defence against 2010 finalists Netherlands on 13 June, with Chile and Australia completing the rest of Group B.