Hernandez started the play from midfield, passing to Olivier Giroud, who then set up Leao to release Hernandez for the goal.
Milan continued to create chances, with Leao and Alessandro Florenzi testing Napoli’s goalkeeper, Pierluigi Gollini.
However, Napoli also had their moments, with Matteo Politano coming close with a curling effort that skimmed the post.
In the second half, Napoli made changes to their formation, but Milan remained solid defensively.
Napoli had a late double opportunity in the 89th minute, with Jan Simic hitting the post and Politano’s follow-up saved by Milan’s goalkeeper, Mike Maignan.
The match also saw some controversial moments, including penalty appeals for Napoli, but the referee deemed them to be fair challenges.
Milan held on to secure the win, ending Napoli’s unbeaten run at San Siro and keeping their own Champions League hopes alive.