Spain coach Julen Lopetegui has been sacked just two days before the team's first World Cup match against Portugal, Spanish football association announced Wednesday.
Lopetegui was let go a day after Real Madrid announced him as its new coach following the World Cup.
Federation president Luis Rubiales says it wasn't the best solution for the national team but the action was needed after it was caught by surprise by Real Madrid's announcement.
"We have felt obliged to dismiss the coach. We cannot have an employee negotiating a contract with another team and only find out about it five minutes before the announcement," Rubiales said.
"We have to remember all the good things he has done to get us here. But there are certain rules to follow and they have not been followed and we felt we had no choice."
Later on Wednesday Spain named federation sporting director Fernando Hierro as its World Cup coach to replace Lopetegui.
"Fernando Hierro will assume coaching responsibilities at the World Cup in Russia," the Spanish football federation announced.
The 50-year-old Hierro's only real coaching experience came when he was in charge of second division Spanish outfit Oviedo for one season.