Jens Petter Hauge scored the only goal of the game, but Ciprian Tatarusanu needed a fantastic save in stoppages to beat 10-man Sparta Prague and win the Europa League group.
As Lille were beaten 3-2 in Glasgow by bottom of the table Celtic, it allows the Diavolo to leapfrog them at the top and get top seed status in the draw.
The Rossoneri were already qualified for the Europa League Round of 32 and had only a slim chance of topping the group, so rested most of their stars in favour of a very young team, plus Leo Duarte’s first start in a year.
Diogo Dalot forced an early save at the back post, but after a period of Sparta pressure, it was Jens Petter Hauge who opened the scoring.
Hauge nutmegged a defender to burst into the box down the left and placed the snooker shot into the far bottom corner across the goalkeeper, almost a replica of his goal against Celtic.
Lorenzo Colombo nodded wide from a corner, another Hauge run was blocked off by a defender and Samu Castillejo squirmed between two players to force a reaction save with Milan Heca’s leg from point-blank range.
Ciprian Tatarusanu was called into action after the restart, using his body to deny Ladislav Krejci at the far post, while Castillejo went for goal on the counter and tested the ‘keeper.
David Moberg-Karlsson came off the bench and immediately floated a dangerous cross just past both the head of his teammate and the far post.
Rafael Leao made his comeback from several weeks out with injury, but the moment he started his first sprint, he was hacked down by Dominik Plechaty for a straight red card.
The Rossoneri wasted several opportunities on the counter to extend their lead with Castillejo, Rade Krunic and Hauge.
Instead, 10-man Sparta Prague almost got the equaliser at the 92nd minute when a ball floated over the top released Moberg-Karlsson, he had time to pick his spot with the inside of the boot, but Tatarusanu at full stretch just got his fingertips to it.
Sparta Prague 0-1 Milan
Hauge 23 (M)
Sparta Prague: Heca; Vitik, Plechaty, Lischka; Wiesner, Sacek (Krejci 82), Soucek, Karabec (Krejci 45), Polidar; Minchev (Julis 65), Plavsic (Moberg-Karlsson 66)
Milan: Tatarusanu; Conti, Duarte, Kalulu, Dalot; Krunic, Tonali; Castillejo, Maldini (Kessie 78), Hauge (Brahim Diaz 90); Colombo (Leao 68)
Ref: Siebert (GER)
Sent off: Plechaty 77 (S)