The Italian striker guided a volley into the top corner after 43 minutes as the hosts finally made their pressure count.
It was a welcome victory for the Neapolitans after a run of one win in their last six league outings and three straight league defeats at home.
The result left Napoli third with 43 points, five behind leaders AC Milan, while Samp are 15th with 20 points.
Juan Jesus had a headed goal disallowed for offside following a VAR review, while Emil Audero was called into action to deny an Amir Rrahmani strike and Faouzi Ghoulam free kick before Petagna's opener.
Giacomo Raspadori and substitute Gianluca Scamacca both scored braces as Sassuolo hammered Empoli 5-1 to draw level with the Tuscans on 28 points, but move ahead of them into ninth place on head-to-head record.