Real Madrid announced Tuesday that Spain coach Julen Lopetegui will become the club's manager after the World Cup.
Madrid said in a short statement that Lopetegui has agreed to coach the Champions League winners for the next three seasons.
Madrid made the announcement three days before Spain's opening match against Portugal in Russia.
He will take the place of Zinedine Zidane, who surprised the club two weeks ago by saying he was leaving after winning an unprecedented three straight Champions League titles.
Lopetegui has kept Spain unbeaten through 20 matches since taking over two years ago from Vicente del Bosque following the team's failure to successfully defend its title at the 2016 European Championship.
Lopetegui guided Spain to a first-place finish in a qualifying group that included Italy for the 2018 World Cup.
Just last month Lopetegui agreed to extend his contract with Spain's national team through 2020.
Lopetegui was picked as Del Bosque's replacement mostly because of his success with Spain's youth squads. He won European championships with the under-19 and under-21 teams in the early 2010s.
While shining with Spain's national sides, he had a lackluster stint with Portuguese club Porto in his only job with a top team.