Darwin Nunez scored a fine goal as Liverpool saw off West Ham to extend their unbeaten run to 18 games.
Mohamed Salah gave Liverpool the lead against the run of play with a penalty after he was brought down by Nayef Aguerd.
Jarrod Bowen levelled for West Ham with an excellent stooping header to meet Vladimir Coufal's cross.
Soon after Curtis Jones had a goal ruled out for Liverpool for offside.
Nunez put them ahead with a difficult hooked volley from Alexis Mac Allister's clipped ball over the top.
The Hammers played well in stages but never created a clear-cut chance to equalise.
And Diogo Jota sealed the points when he pounced from close range to turn home Virgil van Dijk's header.
West Ham boss David Moyes has now lost 24 Premier League games against Liverpool, a joint record for a manager against one team, level with Harry Redknapp against Manchester United.
Follow reaction hereHow did you rate Liverpool's performance? Have your say hereWhat did you make of West Ham's display? Send us your views hereMore to follow.
How to play
Rate players out of 10 throughout or after the game. The rater will close 30 minutes after the final whistle.
Rating range key1 = Give it up10 = Pure perfection
Liverpool
Squad number1Player nameAlisson
Squad number2Player nameGomez
Squad number32Player nameMatip
Squad number4Player namevan Dijk
Squad number26Player nameRobertson
Squad number8Player nameSzoboszlai
Squad number10Player nameMac Allister
Squad number17Player nameJones
Squad number11Player nameMohamed Salah
Squad number9Player nameNúñez
Squad number7Player nameDíaz
Squad number3Player nameEndo
Squad number18Player nameGakpo
Squad number20Player nameDiogo Jota
Squad number38Player nameGravenberch
West Ham United
Squad number23Player nameAreola
Squad number5Player nameCoufal
Squad number4Player nameZouma
Squad number27Player nameAguerd
Squad number33Player nameEmerson
Squad number28Player nameSoucek
Squad number19Player nameÁlvarez
Squad number20Player nameBowen
Squad number7Player nameWard-Prowse
Squad number10Player nameLucas Paquetá
Squad number9Player nameAntonio
Squad number8Player nameFornals
Squad number14Player nameKudus
Squad number18Player nameIngs
Line-ups
Liverpool
Formation 4-3-3
1Alisson2Gomez32Matip4van Dijk26Robertson8Szoboszlai10Mac AllisterSubstituted forEndoat 88'minutes17JonesSubstituted forGravenberchat 77'minutes11Salah9NúñezSubstituted forGakpoat 81'minutes7DíazSubstituted forJotaat 81'minutesSubstitutes
3Endo5Konaté18Gakpo19Elliott20Jota21Tsimikas38Gravenberch62Kelleher78QuansahWest Ham
Formation 4-2-3-1
23Areola5Coufal4ZoumaBooked at 82mins27Aguerd33Emerson28SoucekSubstituted forFornalsat 74'minutes19ÁlvarezBooked at 36mins20Bowen7Ward-Prowse10Lucas PaquetáSubstituted forIngsat 87'minutes9AntonioSubstituted forKudusat 74'minutesSubstitutes
1Fabianski8Fornals14Kudus15Mavropanos17Cornet18Ings21Ogbonna22Benrahma24KehrerLive Text
Match ends, Liverpool 3, West Ham United 1.
Second Half ends, Liverpool 3, West Ham United 1.
Attempt missed. Pablo Fornals (West Ham United) right footed shot from the left side of the box misses to the right.
Foul by Wataru Endo (Liverpool).
Mohammed Kudus (West Ham United) wins a free kick in the attacking half.
Attempt saved. Cody Gakpo (Liverpool) header from the centre of the box is saved in the centre of the goal. Assisted by Virgil van Dijk with a headed pass.
Dominik Szoboszlai (Liverpool) wins a free kick in the attacking half.
Foul by Nayef Aguerd (West Ham United).
Attempt missed. Dominik Szoboszlai (Liverpool) left footed shot from outside the box is just a bit too high.
Attempt blocked. Diogo Jota (Liverpool) right footed shot from the centre of the box is blocked. Assisted by Andy Robertson.
Cody Gakpo (Liverpool) wins a free kick in the defensive half.
Foul by Edson Álvarez (West Ham United).
Corner, Liverpool. Conceded by Nayef Aguerd.
Attempt blocked. Cody Gakpo (Liverpool) right footed shot from the right side of the box is blocked. Assisted by Dominik Szoboszlai.
Substitution, Liverpool. Wataru Endo replaces Alexis Mac Allister.
Foul by Ryan Gravenberch (Liverpool).
James Ward-Prowse (West Ham United) wins a free kick in the defensive half.
Substitution, West Ham United. Danny Ings replaces Lucas Paquetá.
Foul by Diogo Jota (Liverpool).
Lucas Paquetá (West Ham United) wins a free kick in the defensive half.