Jurgen Klopp’s side were certainly not at their best but took the lead in the first half through Sadio Mane.
West Ham missed huge chances to equalize, with Pablo Fornals and Manuel Lanzini both swelling their lines, as Liverpool held on despite a number of scares to keep the pressure on City, who face Manchester United on Sunday afternoon.
Liverpool got off to a fast start and came close to taking the lead with just over a minute played. Trent Alexander-Arnold clipped a quick free-kick to Mohamed Salah and the Egyptian was behind the West Ham defence, but Lukasz Fabianski did well to deny it.
Although they looked vulnerable early on, West Ham grew in the game and offered a real threat on the break, especially through Michail Antonio, as Liverpool’s high line provided opportunities.
However, the visitors fell behind just before the half hour mark. Alexander-Arnold drilled the ball towards the far post from the edge of the box, Fabianski threatened to pick it up only to pull away and that allowed in Mane a simple finish.
With just over five minutes remaining, Pablo Fornals was scored on goal with only Alisson to beat. His weak lob beat the goalkeeper but he allowed Alexander-Arnold to come back and clear him off the line. Fornals was then denied the rebound, before Nikola Vlasic rounded Alisson and his shot was deflected as David Moyes watched in dismay.
The Hammers had ten shots in the first half – no side have had more in the first 45 minutes against Liverpool at Anfield in the Premier League since Klopp took over.
Potentially the most concerning aspect of the evening for West Ham came shortly after the break, when Jarrod Bowen limped off injured. The ever-present winger now looks doubtful for the move to Sevilla in the Europa League on Thursday.
West Ham wasted another huge chance to equalize with 20 minutes left. This time Manuel Lanzini was the culprit after a great cross from Tomas Soucek, showing great composure at the start and then lifting his effort over the bar from six yards out as he looked certain to score.
Mark Noble played a stunning pass to clear Antonio and he cut inside past Andy Robertson in the box but Naby Keita came back very well to keep the shot from disturbing Alisson.
It was to be the last chance for the visitors as West Ham had to reflect on what might have happened had they come to Anfield with a more ruthless touch.