Lopetegui started working as a manager in 2003, and spent several years in charge of Spain's youth teams, leading the under-19 and under-21 sides to European titles. He was also head coach of the senior national team for two years, but was dismissed before the start of the 2018 World Cup following the announcement of his agreement to join Real Madrid after the tournament. In club football, he has managed Rayo Vallecano, Castilla, Porto, Real Madrid and Sevilla, winning the 2020 Europa League with the latter side.