Luis Enrique has stepped down as Spain coach for personal reasons and will be replaced by his assistant Roberto Moreno, the Spanish Football Federation announced on Wednesday.
Moreno has been in charge for Spain's last three matches and will now lead the team through Euro 2020 qualifying and the final tournament, in what is his first job as a professional coach.
He will be Spain's fourth in 12 months, after Luis Enrique was appointed following last year's chaotic World Cup, which saw Julen Lopetegui sacked and Fernando Hierro installed in his place.
"Luis Enrique has informed us he will not continue as coach," said RFEF president Luis Rubiales in a press conference.
"We completely respect his situation and continue to do so in the same way. I have to thank Luis Enrique for his time with the federation and the doors of the national team will always be open to him."
Rubiales added: "Robert will take over as coach, with the same length of contract that was signed before. He will be in charge of taking us to and and overseeing a good showing at Euro 2020."
Moreno, previously a scout and opposition analyst, has worked with Luis Enrique in all of his previous coaching roles, at Celta Vigo, Roma and Barcelona.
But his first job as a head coach will be to rebuild one of the world's most talented international teams.
"I have been with Luis in some of the most demanding changing rooms in the world for nine years," Moreno said.
"If we win the Euros, nobody will remember if the coach had more or less experience."
After crashing out to Russia in the last 16 of the World Cup, Luis Enrique oversaw impressive wins over England and Croatia in the Nations League, and a 4-1 thrashing of Wales in a friendly.
Yet two defeats at home to England and away to Croatia meant they finished second in their Nations League group behind England, and failed to reach the semi-finals.
Despite that disappointment, Spain recovered by winning five games on the bounce, four of them in qualifying for Euro 2020 which has them sitting top of Group F, five points ahead of Sweden.
But Luis Enrique was unable to attend the latest victories over Malta, the Faroe Islands and Sweden, with Moreno overseeing all three in his absence.
"Robert told us that if we did not want him and his staff they would leave, that they did not want to be a nuisance," said Rubialies. "But we hired Luis Enrique with his team and his team is working very well. We believe they are the best option."
Moreno added: "It's a bittersweet day. I dreamt of becoming a head coach one day but not in this way.
"We will try to continue what Luis Enrique has started and to finish his work at the top, by winning Euro 2020."