But Salah restored the two-goal advantage after the break, and Diogo Jota then capped off a memorable win.
It means Everton are now eight league matches without a win, and manager Rafa Benitez is under huge pressure to turn the club’s fortunes around.
It was a breathless first 45 minutes at Goodison, and Liverpool threatened to run away with it.
Joel Matip and Salah both should have scored inside the opening two minutes, but the opening goal did come shortly after.
Andrew Robertson got to the byline and cut the ball back, and Henderson ran onto it on the edge of the box before producing a wonderful left-footed finish.
Before 20 minutes were on the clock, it was 2-0. Henderson played in Salah on the right, and he burst past Lucas Digne to curl it beyond Jordan Pickford.
Some Everton fans headed for the exists at that point, but Gray gave the home side a lifeline with seven minutes to go until half-time.
He controlled Richarlison’s pass well, and his effort had enough on it under Alisson to halve the deficit.
Everton pressed for an equaliser in the second half, and Andros Townsend had a dangerous free-kick headed over.
From that corner, Liverpool extended their lead once again. Seamus Coleman hesitated as the ball came to him on the halfway line, Salah robbed him, and ran clean through. The Egyptian finished cooly past Pickford, even as he lost his balance.
Jota got in the act, turning past Allan brilliantly before smashing it home at the near post to make it 4-1.
The rest of the match took place without real incident, as Liverpool fans basked in the derby win with chants of “Rafa’s at the wheel”, with their former manager facing a real task to get the Everton supporters back on side.