Spain coach Julen Lopetegui will replace Zinedine Zidane in charge of Real Madrid after the World Cup, the Spanish giants said Tuesday in a surprise move. “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,” Real said in a statement. The unexpected announcement comes shortly after Lopetegui extended his contract as Spain coach until 2020 in what was a pre-World Cup boost for one of the tournament favourites. And it comes just three days before the 2010 World Cup winners begin their campaign in Russia, as they face Portugal in Sochi on Friday. Lopetegui was appointed to the role in the wake of Spain’s poor showing at Euro 2016 in France when they were eliminated in the last 16, losing 2-0 to Italy. Zidane quit Real on May 31, saying he had decided to leave at the top and that it was time for a change for himself and the club, as well as admitting he was unsure of his ability to maintain his remarkable record at the Santiago Bernabeu. Madrid won a third consecutive Champions League title by beating Liverpool in last month’s final in Kiev, becoming the first team to achieve that feat in more than 40 years. However, they finished third in La Liga — 17 points behind champions Barcelona — and were eliminated at home by modest neighbours Leganes in the quarter-finals of the Copa del Rey. When he announced his resignation, Zidane said that had been the worst moment of his coaching career with the club. His decision to quit as Madrid coach suddenly left the Spanish giants in limbo. Tottenham Hotspur manager Mauricio Pochettino had initially emerged as the leading candidate to replace the Frenchman. As a player, Lopetegui was a goalkeeper on Real’s books early in his career, and he returned for a spell in charge of their second team a decade ago. He went on to coach Porto before succeeding Vicente del Bosque, who had overseen Spain’s triumphs at the 2010 World Cup and Euro 2012 but had also been in charge for the disappointing group-stage exit at the 2014 World Cup in Brazil. La Roja cruised through qualifying for this year’s World Cup, with nine wins and a draw in 10 games, scoring 36 goals and conceding three. Indeed, Spain are still unbeaten under the Basque after 20 matches including friendlies.