Spalletti, 64, led Napoli last season to their first Serie A title in 33 years, crowning a long club management career that has included spells at Roma, Inter Milan, and a five-year stint with Russian club Zenit St Petersburg.
He stepped aside from the Napoli job in May after requesting a sabbatical and was replaced by Rudi Garcia.
The Italian Football Federation said on its website that Spalletti would take up the post from Sept. 1.
"The national team needed a great coach and I'm very happy that he accepted," federation president Gabriele Gravina said.
"His enthusiasm and his expertise will be fundamental for the challenges that await Italy in the coming months."
A source told Reuters that Spalletti's contract will run until the 2026 World Cup. The official statement did not specify the length of his contract.
Spalletti will be the national side's ninth coach this century.
Italy are third in Group C on three points from two matches, trailing Ukraine on six points from three games. England lead the group with 12 points after four matches.
When leaving Napoli, Spalletti said he was taking a sabbatical year and added he could be open to coaching a national team after his year off.
Mancini's resignation provided an opportunity earlier than expected.
However, when Spalletti left Napoli he signed a document that included a clause of €3 million ($3.3m) to be paid if he returned to work within a year of his contract.
Federation lawyers maintain it is a sort of non-compete clause and counts only for clubs that are rivals to Napoli. But Napoli president Aurelio De Laurentiis has remained equally firm that it also applied to the national team.
"I asked for guarantees that [Spalletti] would respect this sabbatical, including a penalty in the event of his commitment wavering," De Laurentiis said in a recent statement. "[The FIGC] should not be put off by having to pay one million euros per year on the coach's behalf to free him from his contractual obligations [a commitment not only to Napoli, but also to the club's millions of fans]. This is all incoherent.
"Admittedly, €3m is not a lot to Napoli and even less to me, but the question in this case is not about the 'almighty dollar,' but a matter of principle instead."
Information from the Associated Press was used in this report.