Spain coach Julen Lopetegui will take over as Real Madrid manager after the FIFA World Cup 2018, the club said on Tuesday in an announcement that comes just three days before the national team's first game at the tournament.
Madrid said in a short statement that Lopetegui has agreed to coach the Champions League winners for the next three seasons once Spain's participation in soccer's biggest event is over.
The appointment comes as Lopetegui is making his final preparations for Spain's opening match against Portugal in Sochi on Friday.
Lopetegui will take the place of Zinedine Zidane after he surprised the club two weeks ago by saying he was leaving after winning an unprecedented three straight Champions League titles.
Lopetegui was Vicente del Bosque successor for Spain following the team's failure to successfully defend its title at the 2016 European Championship. He has kept Spain unbeaten through 20 matches in charge and guided it to a first-place finish in a qualifying group that included Italy for the 2018 World Cup.
The 51-year-old Lopetegui is credited with reviving a Spain team that was on the decline in the last years under Del Bosque after it won the 2010 World Cup and two straight Euros.
Part of his success was blending in younger talents like Francisco "Isco" Alarcon, Marco Asensio and Rodrigo Moreno into a squad led by veterans Andres Iniesta, Sergio Ramos and David Silva.
Lopetegui will soon coach Ramos, Isco, Asensio and fellow Spanish internationals Dani Carvajal, Nacho Fernandez and Lucas Vazquez at Madrid's Santiago Bernabeu stadium.
His name had not been mentioned by Spanish media among the probable candidates for the Madrid job. Just last month Lopetegui agreed to extend his contract with Spain's national team through 2020.
The immediate reaction on Spanish sports talk radio was to criticize the timing of the announcement given the possible distraction it could cause on Spain's team before a tournament it has spent two years working towards.
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 stint at a major club. He was fired after failing to win a title during almost two years in Portugal.
A former goalkeeper who started a handful of games in goal for Real Madrid and Barcelona, Lopetegui played for Spain in the 1994 World Cup.