The world champions have been knocked out at the group stages, having lost 2-0 to Chile on Wednesday.
First half goals from Eduardo Vargas and Charles Aranguiz sealed Spain’s fate.
Chile play the Netherlands in São Paulo on Monday in a match which will decide who tops Group B.
If Brazil progress to the knock-out stages they will face one of those two teams.