The hosts took the lead on 29 minutes when Emre Can headed in Mohamed Salah's corner for their 100th goal of the season in all competitions.
Shortly after half-time Salah moved level with Harry Kane on 23 goals for the season after good work from Alex Oxlade-Chamberlain.
Roberto Firmino made it 3-0 before the hour, collecting Can's pass and rounding Adrian for an empty net.
Michail Antonio pulled one back a minute after coming on as a substitute but Sadio Mane's close-range finish restored Liverpool's three-goal advantage.
The Reds are a point above Man Utd, who host Chelsea on Sunday. The Hammers drop to 13th.
Liverpool: 3 Mar v Newcastle (H)
West Ham: 3 Mar v Swansea (A)