Italy only needed the draw in a game played in Leverkusen, Germany, in order to qualify but a defeat against their direct rivals in Group C would have left their fate to be decided in play-offs next March.
Bruno Fernandes and Ricardo Horta netted the goals for Roberto Martinez's Portugal, with Cristiano Ronaldo not on the scoresheet, to end with 10 wins from 10 matches in Group J.
Les Bleus set a new record margin of victory in European qualifying and a national record in Nice.
Albania also qualified on Friday, drawing 1-1 in Moldova to ensure they would finish in the top two in Group E.
Needing a point to be certain of qualifying for next year's tournament in Germany, Gareth Southgate's side fell behind to Gianluca Scamacca's early goal.
France international Jean-Clair Todibo on Monday apologised for laughing during a minute's silence in memory of the victims of the Israel-Hamas conflict and a murdered French teacher before a Euro 2024 qualifier last week.
Ronaldo netted his 126th and 127th Portugal goals, further extending his record as the top all-time men's international goalscorer.
Spectators at the King Baudouin stadium in the Belgian capital were told to remain inside the ground following an announcement that the players would not return for the second half
Barcelona midfielder Gavi scored the only goal early in the second half in Oslo, bouncing a shot into the corner to help Spain qualify for next year's finals in Germany with two games to spare.