Spain coach Julen Lopetegui will take over as Real Madrid boss after the World Cup, the La Liga giants have announced.
The move comes as a surprise, with Lopetegui not featuring prominently among the host of managers linked with the role since the departure of Zinedine Zidane days after Madrid's 3-1 victory over Liverpool in the Champions League final.
Lopetegui, who has been in charge of the national team for the past two years, has agreed a three-year contract at the Bernabeu.
A club statement said: "Real Madrid CF announces that Julen Lopetegui will coach the first team for the next three seasons.
"Julen Lopetegui will join the club after the participation of the Spanish team in the World Cup, after two years leading the national team."
Former goalkeeper Lopetegui, 51, made a sole league appearance for Madrid as a player, and later turned out for rivals Barcelona a handful of times. He coached Madrid's feeder club Castilla in 2008/09 before taking charge of Spain's youth teams.
In May, he signed a two-year extension to remain as Spain coach until 2020 but the call of Madrid has proved stronger.
The boos that rang around the BayArena on Friday night and were still being vigorously debated across Germany all weekend were certainly an unusual send-off for a team attempting to become the first in more than 50 years to successfully defend their World Cup crown.