His debut match in charge will be Italy's 2024 European Championship qualifier in North Macedonia on September 9.
Spalletti has just led Napoli to the Serie A title for the first time since 1990 but there has been speculation about whether he would stay on.
Napoli's triumph ended their long wait for the Scudetto since Argentine great Diego Maradona led them to two championships in 1986-87 and 1989-90.
With eight games left to play in this season, the decision lifts Juventus from seventh to third in the Serie A table - with 59 points.
The Italian side were magnificent in the opening 45 minutes, going in 3-0 up at the break having opened up a woeful Liverpool defence at will.
Real Betis defeated 3-2 Zenit St Petersburg after scoring twice in the first 20 minutes.
The Argentine, who was also a professional footballer and joined Diego at Napoli in 1987 aged 18, died at his home near Naples.
Spartak Moscow won 1-0 at Legia Warsaw to secure an automatic last-16 berth.
Maradona's family marked the first anniversary of his death on Thursday by revealing that one of his last wishes was for his remains to be left in a mausoleum where fans can pay homage to the former Argentina great.
Second-half goals by Carlos Vinicius and Giovanni Lo Celso earned Tottenham a 2-0 win over Royal Antwerp as they leapfrogged the Belgians who had also qualified from Group J.