Napoli, needing to overturn a 1-0 deficit, were boosted by the return of Victor Osimhen after being injured while on international duty.
On a rare Milan attack midway through the opening half, Rafael Leao was felled by Mario Rui in the box. However, Alex Meret guessed right and saved Giroud's spot kick.
Soon after Giroud was again denied by Meret. But the French veteran could not miss after 43 minutes when Leao seized on a loose ball, sprinted forward on a 70-yard slalom run, and rolled a cross into his path six metres out.
With Osimhen poorly served and well-shackled, Neapolitan hopes were drifting away when they were gifted an 82nd-minute penalty after Giovanni di Lorenzo's cross hit the arm of Fikayo Tomori.
But, summing up the Serie A leaders’ night, Mike Maignan dived to his right to push away Khvicha Kvaratskhelia’s effort.
Osimhen scored with a bullet header in added time, but it was too little, too late.
“It has been a long path. We were considered underdogs against Napoli, but I coach a group with a big heart,” Milan coach Stefano Pioli said.
“We grit our teeth and suffered (but) deserved the qualification.”
AAP