"Welcome Luciano, together we will do a great job," the Serie A club's president Aurelio De Laurentiis posted on twitter.
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.
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.