Liverpool was set to lose points in this fixture but Sadio Mane's 81st-minute goal sealed a victory for the league toppers at Anfield.
Liverpool's 3-2 win over West Ham has earned them a record-equalling 18th consecutive Premier League match win this season on Monday.
Also read: Champions League: Simeone's Atletico stun mighty Liverpool in 1st leg of round of 16
The last time Jurgen Klopp's side dropped points was back in October, where they drew their Manchester United fixture. Liverpool was set to lose points in this fixture but Sadio Mane's 81st-minute goal sealed a victory for the league toppers at Anfield.
Also read: Liverpool march on with 4-0 rout of Southampton
Liverpool's Georginio Wijnaldum struck first at 9th minute but soon West Ham's Issa Diop equalised in the 12th minute. The half-time whistle blew with scores tied.
In the second half, Pablo Fornals' 54th-minute goal gave West Ham a stunning lead at Anfield. Mohammed Salah equalised the scoreline in the 68th minute. The winning goal was struck by Sadio Mane in 81st minute.
Jurgen Klopp was pleased by his team's performance, he said: "I never thought it would be broken or equalled. We did it and I cannot believe it happened to be honest," Klopp said of the record.
"Whatever will happen this season is an effort of all of us. So far, so good."
Their 21st successive league victory at Anfield also equalled their own English top-flight record for consecutive home wins, set by Bill Shankly's team between January and December 1972.
Liverpool needs four victories from their final 11 games to guarantee a first English title since 1990.
They are unbeaten in their last 44 league matches, just five short of Arsenal's all-time English record of 49.