Eljif Elmas' first-half strike was the difference as Napoli leapfrogged Milan into second in Serie A with a 1-0 victory on Sunday.
Luciano Spalletti's side lost consecutive league games against Atalanta and Empoli but struck first after just four minutes at San Siro through Elmas' header – his first top-flight goal since August.
Stefano Pioli's team pressed on in the second half but were unable to mount a comeback as their winless home league run against Napoli – which dates back to December 2014 – continued, although only a VAR intervention denied Franck Kessie a late equaliser.
Napoli overtake Milan to move into second, with the pair four points back from reigning champions Inter heading into the final matchday of 2021 on Wednesday.
The visitors were soon ahead when Elmas nodded in Piotr Zielinski's corner at the near post, Napoli scoring their fastest Serie A goal against Milan since November 2012.
Zlatan Ibrahimovic responded by flicking a header wide, while Alessandro Florenzi blasted a speculative long-range half-volley just off target as Milan failed to test David Ospina before the interval.
Ospina, though, was required immediately after the break to palm over from Ibrahimovic, with the Colombia international denying Junior Messias moments later.
Napoli had conceded six of their past seven league goals in the final 30 minutes, while Milan had scored the joint-most in that period (15), and Messias almost furthered that record but curled just wide.
Kessie thought he had netted a late leveler as he swept into the bottom-left corner, only for VAR to judge the prone substitute Olivier Giroud to be offside as the visitors managed to hang on to an important victory.