The 51-year-old specialist has agreed a three-year deal with the 33-time La Liga champions who have been without a manager following Zinedine Zidane's resignation on 31 May.

Lopetegui, a former goalkeeper, managed Spain at Under-19, Under-20 and Under-21 level before moving to Porto in 2014.

He took charge of the Spanish national team in July 2016.