Napoli’s win took them on to 77 points from 35 games, two more than AS Roma who visit AC Milan on Sunday.
Second place earns a spot in the Champions League group stage next season while the third-placed team have to go into the playoff round where Italian sides have a poor record.
Mertens got Napoli off to a flying start when he turned in Faouzi Ghoulam’s cross after two minutes.
Napoli were so confident and dominant that Marek Hamsik tried to score from near the halfway line after seeing goalkeeper Rafael off his line but his effort landed on the roof of the net.
Mertens struck again with a low shot from the edge of the penalty area four minutes after the restart and then set up the third with an astute pass to Lorenzo Insigne, who finished clinically.
Diego Farias broke away to pull one back in stoppage time for Cagliari.