When the Serie A leaders' goalkeeper Alex Meret barely kept substitute Darwin Nunez's header from crossing the line, the Egypt international followed up to force the ball home.
It was his 41st European goal - all coming in 64 Champions League appearances - and his 12th in all competitions this season.
Salah also matched Gerrard's record of 18 Champions League goals at Anfield in his 29th outing.
Midfielder Gerrard's European goals came over 129 games in the Champions League, Europa League and UEFA Cup including qualifying rounds.
Nunez then scored for a third successive European game with the last kick when Meret spilled Virgil van Dijk's header, although it required VAR to overturn an errant offside flag.
The victory ensured a Champions League group stage which had begun with a 4-1 humbling in Naples, offering a portent of the difficulties to come, finished on a high even though Jurgen Klopp's side had already qualified for the knockout stage going into this game.
That this match passed with little alarm - with the second-half goal they conceded to Leo Ostigard eventually ruled out by VAR - was a positive.
And while that may be a low bar to set after back-to-back defeats to the Premier League's bottom two sides, Liverpool will take any confidence boost they can - although the loss of James Milner to injury was the downside.
Napoli, off the back of 13 successive victories, did not need to win the game to top Group A and Liverpool's chances of effecting a four-goal margin of victory seemed unlikely considering their current travails.
They also have a far more important meeting with Tottenham in London on Sunday where they will hope to get their Premier League season back on track, with captain Jordan Henderson rested for this game with that in mind.
As a result the first half was largely unremarkable, with Curtis Jones chipping over the onrushing Meret and the crossbar from a tight angle and later placing his header too high from Roberto Firmino's backheel flick.
Liverpool's best move came after Tanguy Ndombele's shot was comfortably saved by Alisson Becker and immediately from Thiago Alcantara's sumptuous pass out to Salah, the ball was in the other penalty area with Thiago charging forward to force a better save out of Meret.
Napoli's exciting winger Khvicha Kvaratskhelia posed a threat with a driving run from deep but Ibrahima Konate leant heavily enough on the Georgia international to force him off the ball in the penalty area.
Konate's return to the team, replacing the out-of-sorts Joe Gomez for only his second start of the season after injury, was one of the positives and his partnership with Van Dijk offers some hope of greater defensive stability.
Thiago continues to be Liverpool's best midfielder, although considering Klopp's limited options he is not facing much competition, and he dominated the ball without quite finding the killer pass.
Resources in the centre were depleted further early in second half when Milner went off and was replaced by Harvey Elliott.
Napoli did eventually breach the Van Dijk-Konate partnership - all too easily in truth - but their set-piece goal fell foul of a three-minute VAR review.
Kvaratskhelia's 53rd-minute free-kick was an inviting one but apparently not so much so for Liverpool's centre-backs, who allowed Ostigard to ghost in between them and plant a free header from six yards past Alisson only to be ruled fractionally offside.
Salah should have scored with an instinctive close-range volley late on but steered it into the hands of Meret, but he did not pass up a second chance when it fell to him five minutes from time and Nunez then added an almost carbon-copy second.