The home side took the lead after just two minutes when Goran Pandev's pass found Cavani, who finished expertly.
Christian Maggio then went close on 12 minutes, but his shot was just blocked by the oncoming defence.
The away side were given a golden opportunity to draw level when the referee awarded them a penalty on 22 minutes. Ricardo Alvarez stepped up and confidently made it 1-1.
© AP Photos
Napoli were awarded a penalty of their own 10 minutes later and Cavani made no mistake from the spot to give the home side the lead.
Marek Hamsik was presented with the first real opening of the second half on 50 minutes, but his hesitation allowed the defence to get back and block his effort.
Andrea Ranocchia rose well two minutes later, but his header went just wide of the mark.
Alvarez found room for a strike on goal on 58 minutes, but he dragged his shot too wide.
Cavani grabbed his hat-trick on 77 minutes, racing to the back post to get on to the end of Pandev's cross to make 3-1 and all but secure the points for Napoli.
© AP Photos
The Uruguayan came close to a fourth goal on 81 minutes, smashing towards goal from the edge of the area, but it went just wide of the post.