Ronaldo's 15th minute opener was cancelled by Roberto Sosa in the 28th minute. Clarence Seedorf restored the hosts' lead in the 31st minute after Alexandre Pato, who made his debut for Milan, was denied twice.
But that was only for 7 minutes as Maurizio Domizzi leveled the score again from the spot to end the first half on a 2-2 draw.
In the second half the Brazilian magic was at its best. Ronaldo made it 3-2 with a brilliant diving header.
Kaka put the match out of reach for Napoli when he sent a rocketing ball into the top corner of the goal in the 68th minute.
Finally Pato registered his debut with the final goal after superbly intercepting a long ball to slot it in the back of the net.
AC Milan are now 12th with 21 points, 23 behind leaders Inter Milan.