The 51-year-old looked tense as he prepared his Spain players for their opener with Portugal
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.
Lopetegui will manage Barcelona stars including Gerard Pique during the World Cup
Lopetegui has signed a three-year deal to replace Zinedine Zidane as Real Madrid boss
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.
Lopetegui recently signed a contract extension with the Spanish national team until 2020
Lopetegui will get the chance to see Real Madrid star man Cristiano Ronaldo during Spain’s opening World Cup game against Portugal on Friday evening.
The former goalkeeper came close to managing Wolves before he joined Spain in 2016.
He said back in November 2016: ‘When the federation called, naturally my objective became the national team, but it’s true that before that (Wolves and I) had been working hand in hand for some time. ‘It was very close but in the end it wasn’t to be.
‘I enjoyed the time I spent with them; there were job offers from the Premier League but their project was especially attractive.
‘Wolves is a great club, where there would be significant investment and a desire to grow, to shine again.’
Lopetegui will instead manage the European champions next season.
One of his first tasks will be to hold talks with Gareth Bale as the Champions League matchwinner’s future is far from certain.