Sadio Mane's first-half goal was enough to give Liverpool victory over West Ham at Anfield and move them back within three points of Premier League leaders Manchester City.
Jurgen Klopp's men deserved the win but it did not come without the odd scare as Pablo Fornals and Manuel Lanzini both wasted excellent chances to equalise.
The Hammers' frustrations were compounded by the loss of in-form Jarrod Bowen to what looked like a significant injury, the forward helped off the pitch and down the tunnel following a collision with former Hull team-mate Andy Robertson.
Five days before the Europa League last-16 first-leg trip to Sevilla, it was not what manager David Moyes needed.
Liverpool had chances to extend their lead, with new signing Luis Diaz particularly impressive.
However, with the title race as it is, victory was all that mattered. And now Liverpool fans are in the unusual position of hoping for a United victory in Sunday's Manchester derby at Etihad Stadium.
"We could have done better. We did pretty well first half, but in the second half if you are not better, you need quick legs, big heart and passion and that's what we needed to get the result," Klopp told BBC Match of the Day.
"In the end it was open, we needed a bit of luck, but you cannot win as many games in a row as we have without a bit of luck."
- Reaction to Liverpool v West Ham and the rest of Saturday's Premier League games
- Visit our Liverpool page
- Go straight to all the best West Ham content
Life might have been far less stressful for Liverpool's fans had Mohamed Salah taken the first-minute chance that came his way, instead of firing straight at goalkeeper Lukasz Fabianski.
At times, Liverpool's attack is so fast and fluid it is impossible for opposition defences to cope. And in Diaz, their £37.5m January arrival from Porto, they have a player that fits that template perfectly.
The Colombian produced a wonderous piece of skill to create an early chance for himself which he drove into Craig Dawson's face.
Diaz then came close twice in the second half too, with the first of those particularly impressive in the way he manipulated Mane's pass into a scoring chance that went narrowly wide. When he was replaced in the final minute of injury time, his standing ovation was fully deserved.
"He is a top player - a most easy player to coach because all the things he is doing are pretty natural to him," added Klopp. "There is not a lot of coaching necessary. Of course he needs to work on one or two things we do defensively, but he is very football smart, has a big heart and wants to fight extremely hard for the team."
In the end, though, Trent Alexander-Arnold's precise low cross created the one moment that mattered.
The England man's 16th assist of a stellar season was one of his best, leaving Mane to turn home his fourth goal in five games from close range.
West Ham have lost 70 league matches against Liverpool, have now won once at Anfield in 52 attempts, and Moyes is without a win in 66 away league games against Liverpool, Chelsea, Arsenal and Manchester United, so perhaps the outcome of the match was not a surprise.
But the Scot will nevertheless wonder how his side failed to capitalise on some excellent chances.
Arguably Fornals had the best when he was put through by Bowen just before the break, but instead of trying to beat Alisson in a conventional manner, he lofted a chip over the Brazilian that lacked pace and Alexander-Arnold was able to get back and clear.
Lanzini then undid all his good work in creating space on the edge of the area by blazing over with only Alisson to beat, while in the final stages Michail Antonio was bearing down on goal only for Naby Keita to get back to deny him.
"The players played really well today, I don't think a draw would have been off the mark but we didn't get it," Moyes told Match of the Day.
"We needed one to go in. We had to ride our luck at the start but we grew into the game and had three big chances, plus one or two other opportunities on top of that."
Those frustrations were only compounded by the loss of Bowen, who was heavily tipped to make Gareth Southgate's England squad for the friendlies against Switzerland and Ivory Coast.
Moyes, clearly, will be more concerned about that trip to Sevilla and in addition to sweating on Bowen's fitness, must hope skipper Declan Rice has recovered from the illness that kept him out of this game in time to be available.
"I think Jarrod will have a scan on his heel area. He has been playing really well for us so it would be a blow if we go into the Sevilla game without him," added the Scot.
"Declan had illness that came on on Thursday and through Friday. We are hoping it will not be too bad but I can't tell at the minute."
Player of the match
with an average of 7.95
Squad number23Player nameDíaz
Squad number10Player nameMané
Squad number66Player nameAlexander-Arnold
Squad number26Player nameRobertson
Squad number14Player nameHenderson
Squad number1Player nameAlisson
Squad number5Player nameKonaté
Squad number3Player nameFabinho
Squad number4Player namevan Dijk
Squad number8Player nameKeïta
Squad number7Player nameMilner
Squad number20Player nameDiogo Jota
Squad number17Player nameJones
Squad number11Player nameMohamed Salah
West Ham United
Squad number28Player nameSoucek
Squad number9Player nameAntonio
Squad number10Player nameLanzini
Squad number1Player nameFabianski
Squad number20Player nameBowen
Squad number3Player nameCresswell
Squad number15Player nameDawson
Squad number16Player nameNoble
Squad number8Player nameFornals
Squad number31Player nameJohnson
Squad number11Player nameVlasic
Squad number51Player nameChesters
Squad number22Player nameBenrahma
Squad number4Player nameZouma
- 4van Dijk
- 8KeïtaSubstituted forMilnerat 90'minutes
- 11SalahSubstituted forJotaat 79'minutesBooked at 89mins
- 10ManéBooked at 90mins
- 23DíazSubstituted forJonesat 90+6'minutes
- 15DawsonBooked at 31mins
- 20BowenSubstituted forBenrahmaat 53'minutes
- 11VlasicSubstituted forNobleat 61'minutes
- 8FornalsSubstituted forChestersat 90+3'minutes
Match ends, Liverpool 1, West Ham United 0.
Second Half ends, Liverpool 1, West Ham United 0.
Substitution, Liverpool. Curtis Jones replaces Luis Díaz.
Attempt missed. Diogo Jota (Liverpool) left footed shot from outside the box is high and wide to the left. Assisted by Sadio Mané following a fast break.
Sadio Mané (Liverpool) is shown the yellow card.
Foul by Jordan Henderson (Liverpool).
Manuel Lanzini (West Ham United) wins a free kick in the attacking half.
Attempt blocked. Luis Díaz (Liverpool) right footed shot from outside the box is blocked.
Substitution, West Ham United. Daniel Chesters replaces Pablo Fornals.
Attempt blocked. Sadio Mané (Liverpool) right footed shot from the centre of the box is blocked.
Substitution, Liverpool. James Milner replaces Naby Keïta.
Diogo Jota (Liverpool) is shown the yellow card for a bad foul.
Foul by Diogo Jota (Liverpool).
Pablo Fornals (West Ham United) wins a free kick in the defensive half.
Corner, West Ham United. Conceded by Andrew Robertson.
Foul by Ibrahima Konaté (Liverpool).
Michail Antonio (West Ham United) wins a free kick in the attacking half.
Corner, West Ham United. Conceded by Naby Keïta.
Attempt blocked. Michail Antonio (West Ham United) right footed shot from the centre of the box is blocked.
Substitution, Liverpool. Diogo Jota replaces Mohamed Salah.