He succeeds Gennaro Gattuso, who left after failing to qualify Napoli for the Champions League.
The southerners finished fifth, one point behind fourth-placed Juventus, after a 1-1 draw at home against Hellas Verona last weekend.
A win would have guaranteed a top four finish, but Napoli missed out on the Champions League for a second straight season.
Spalletti, 62, returns to the dugout for the first time since leaving Inter in 2019 after securing Champions League football for the Milan side in his two seasons at the San Siro.
He won two Italian Cups and a SuperCup with Roma, and two Russian league titles and a cup win in his time at Zenit Saint-Petersburg.
Gattuso was appointed Fiorentina coach on Tuesday, less than 48 hours after announcing he was leaving Napoli.
The 43-year-old former AC Milan and Rangers midfielder and former Milan coach succeeded Carlo Ancelotti at Napoli in December 2019 with the squad plagued by internal dissent.
Gattuso led Napoli to his first major trophy as a coach when they won the Italian Cup last June.