Luis Enrique, whose daughter died of bone cancer in August, is returning to Spain as manager five months after retiring for personal reasons.
Enrique resigned in June after 11 months on the job and announced in August that his nine-year-old daughter, Xana, had died.
The 49-year-old former Barcelona boss has replaced his assistant Robert Moreno.
Moreno was at the helm as Spain beat Romania 5-0 on Monday.
Spain saw it complete its Euro 2020 qualification without losing a game.
Moreno, who also worked under Enrique in Roma, Celta Vigo and Barcelona, said after taking over the job he would "step down" if Enrique ever wanted to return.
Speaking at a news conference Tuesday, Spanish Football Federation President Luis Rubiález said: "Everyone knew that if Luís Enrique wanted to come back, he had the doors open.
"Luis Enrique will continue to the World Cup in Qatar [in 2022]"
Enrique was named head of the national team after Spain's exit from the 2018 World Cup in the last 16.
He was in charge of the League of Nations, where Spain failed to reach the semifinals, and remained in place for the start of their Euro 2020 qualification campaign.
The Spaniard traveled home for personal reasons before Spain's 2-0 win over Malta in March, and Moreno was placed on a temporary charge.
Enrique then withdrew three months later.