The striker was booked for a second time for celebrating among the supporters after scoring his side's second goal in their 2-0 victory at the Wanda Metropolitano.
Atletico appealed against the decision but the RFEF's disciplinary committee has dismissed their argument, meaning Costa must serve a one-match ban and pay a fine of €600.
In citing their reasons for upholding Costa's second yellow card, the RFEF said: "The named player approached the spectators and, furthermore, embraced several fans, which the referee determined could produce a security problem, which is an infraction of the rules."
However, Atletico were successful in overturning the booking given to forward Antoine Griezmann.
The France star was penalised for a foul on Sergio Mora in the 44th minute but the RFEF rescinded the punishment after Atleti provided video footage proving he won the ball in the challenge.