The Spanish Football Federation made the announcement on Wednesday.
The Spanish football federation has appointed technical director Fernando Hierro to replace Julen Lopetegui as manager, who was sacked on Wednesday on the eve of the opening of the World Cup in Russia.
The new coach will have less than 48 hours to prepare his team for their opening World Cup match against Portugal on Friday, to take place in Sochi.
The move comes one day after Real Madrid made the surprise announcement that Lopetegui would become the club's new head coach following the World Cup.
Lopetegui's contract with the Spanish federation, known as RFEF, was extended just weeks ago.
The head of the Spanish football federation, Luis Rubiales, said in a press conference on Wednesday: "We want to thank Julen for all he's done and he's a big reason behind us being in Russia, but we feel obliged to dispense with his services."
"There has to be a message to all RFEF employees and there are ways of behaving that you need to abide by."
Rubiales was ready to fire Lopetegui over how the news went public — and under such short notice to RFEF.
“The coach, while he is a RFEF employee, cannot do things in this way. I found out with a phone call five minutes before the official announcement. We feel obliged to take this decision,” Rubiales told a news conference at the team base in Krasnodar.
Who is Hierro?
Hierro is RFEF's sporting director and former defender for the Spanish national team. He was assistant to Carlo Ancelotti at Real Madrid, followed by his only senior coaching stint with Oviedo in the Spanish second division.
Spain will also play Morocco and Iran in the group stages of the World Cup.