The 58-year-old left Roma despite leading his team to second place in Serie A last season, setting a new club points record although they finished four points behind champions Juventus.
Spalletti takes over from interim coach Stefano Vecchi, who was installed at San Siro following the May sacking of Stefano Pioli, who is the new coach of Fiorentina.
He will be presented to the media at a news conference on Wednesday having been given the chance to lead the club by new owners, Chinese company Suning Holdings Group.
He started his coaching career at Empoli, leading the club to back-to-back promotions to Serie A, before short spells with Sampdoria, Venezia, Udinese and Ancona.
A return to Udinese in 2002 saw him lead the club to Champions League qualification, after which he was appointed by Roma for the first of his two spells.
Spalletti won two Coppa Italias and was named Coach of the Year twice in his first four years at Stadio Olimpico before a switch to Zenit, where he claimed two Russian Premier League titles, returning to Roma in January 2016.