Hierro replaced Julen Lopetegui who was sacked earlier on Wednesday after the federation said he failed to tell them he had agreed to join Real Madrid after the tournament.
President of the Spanish football federation, Luis Rubiales, said: “I know it’s a very difficult situation. I know there’s going to be criticism whatever I do.
“I’m sure this will, in time, make us stronger. I admire Julen very much, I respect him very much. He seems a top trainer and that makes it harder to make the decision.
“You can’t do things this way, two or three days before the World Cup.
“We have been compelled to make this decision.”