© AP Photos
The hosts got off the a fantastic start as Marek Hamsik set up Gokhan Inler to fire them into a fourth-minute lead.
El Shaarawy and then Riccardo Montolivo tried to get Milan level, but Napoli were holding firm.
It was 2-0 on the half-hour as Lorenzo Insigne turned in a Christian Maggio cross, but Milan got a vital goal back just before the break. El Shaarawy was set up by Mattia De Sciglio to halve the deficit.
Kevin Prince Boateng shot wide on 60 minutes as Milan pressed for an equaliser and he again missed the target on 73 minutes.
However, eight minutes from time the visitors were level and it was El Shaarawy again, this time from a Robinho assist.
Despite Milan looking for the winner, Napoli were able to hold on for the point.