But third-placed Inter Milan suffered their second consecutive defeat, falling 1-0 at Sassuolo, to drop five points behind the leaders.
“The important thing is that we won while suffering, as it’s a victory that counts for even more, because Inter lost today as well,” said Hamsik.
“It’s practically a six-pointer. We used up a lot of energy to get the game back on track, but fortunately we brought home the result.”
Napoli were trailing twice in the first half with Gaston Ramirez firing in a freekick after just two minutes to catch Pepe Reina off guard in goal.
But Allan equalised after a quarter of an hour at the San Paolo stadium only for Fabio Quagliarella to convert a penalty after a foul on Ramirez to restore Sampdoria’s lead after 27 minutes.
Quagliaella almost had a second shortly after, before Lorenzo Insigne marked his comeback from a groin strain with a volley on 33 minutes following a Dries Mertens flicked cross.
But it was captain Hamsik who sealed the victory six minutes before the break, again off a Mertens cross, to overtake Argentina legend Maradona’s long held mark.
Napoli held on in the second half despite being reduced to ten men following Mario Rui’s sending off, to open up a four-point lead on Juventus before Saturday’s late match.
Hamsik joined Napoli in 2007 as a 20-year-old and is now captain and a stalwart of the side hoping to win their first Scudetto since the days of Argentina legend Maradona.
Maradona took just seven years to score his 115 goals between 1984 and 1991, helping the team to their only two Serie A titles in 1987 and 1990.