The Spanish FA (RFEF) president Luis Rubiales confirmed the sacking at a press conference in the Russian city of Krasnodar, where the team are based, on Wednesday.
Lopetegui was announced as the new Real Madrid boss on Tuesday, taking over from departed Zinedine Zidane after the tournament.
“I don’t want to get into how Real Madrid should go about things. The Spanish team is the team of all Spain,” Rubiales said.
“If it had been up to Julen it wouldn’t have happened in this way and I wouldn’t have found out five minutes beforehand.
“The negotiation occurred without the RFEF having any information. (We were told) just five minutes before the press release. We have a way of behaving that needs to be adhered to.”
Rubiales is no stranger to Scottish football having made four appearances for Hamilton during the 2009/2010 season.
He arrived with more than 50 games in the Spanish top-flight under his belt but failed to impress.
Rubiales was involved in 3-0 defeats to Kilmarnock and Aberdeen and a 4-1 loss to Rangers in the league, as well as a 2-1 reverse to Ross County in the League Cup.