Julen Lopetegui has been named the new manager just weeks after committing his future to ‘s national team.
Lopetegui signed a deal until 2020 on May 22 but Real Madrid have swooped for his services and he has agreed to join the Spanish giants after the World Cup.
The 51-year-old represented Barcelona as a player for three years but will now take charge of their bitter rivals.
Real Madrid said in an official announcement: ‘Julen Lopetegui will be the Real Madrid coach after the celebration of the 2018 World Cup.
‘Real Madrid announce that Julen Lopetegui will be the coach of the first team during the next three seasons.
‘Julen Lopetegui will join the club after Spain’s participation in the World Cup, after two years leading the national team.’
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.
Arsene Wenger, Antonio Conte and Guti were among the front runners to replace Zidane but Lopetegui has pipped the trio to one of the most coveted jobs in world football.
Lopetegui, who has been in charge of the national team for the past two years, has agreed a three-year contract at the Bernabeu.
It means Lopetegui, who has previously managed the likes of Porto, Rayo Vallecano and Real Madrid’s B side for a year, will coach Barcelona’s Spanish contingent for the next few weeks.
Lopetegui was seen holding talks with Barcelona star Gerard Pique at Spain’s training base in Krasnodar before Real Madrid made an announcement on the Spaniard’s appointment.
Real Madrid’s Sergio Ramos, Dani Carvajal, Nacho, Lucas Vazquez, Marco Asensio and Isco are all currently working under Lopetegui as they were named in his 23-man Spain squad.