The Spanish FA has confirmed that Under-21 coach Albert Celades will take charge of the country at the World Cup.
Celades's first game in charge will be against Portugal on Friday, before Spain play Iran and Morocco in their other Group B ties.
Lopetegui's departure was announced after a press conference was delayed by over an hour, with Spanish FA president Luis Rubiales announcing the decision.
"We have been forced to dispense with the national coach," he said. "We wish him the best of luck."
Spain have won the World Cup once, lifting the trophy in South Africa in 2010.