Sadio Mane broke the deadlock on 26 minutes, tapping in Trent Alexander-Arnold's whipped delivery. He looked as if he could have been offside, although a check from the Video Assistant Referee (VAR) ruled Mane to be marginally onside.
Luis Diaz had an opportunity to double Liverpool's lead soon after when he bundled a shot toward goal from the centre of the 18-yard-box. The attempt made its way past goalkeeper Lukasz Fabianski, but Aaron Cresswell was on hand to clear off the line.
West Ham, who were without star midfielder Declan Rice, came close to netting an equaliser shortly after when Pablo Fornals ran through on goal for a one-on-one with opposing goalkeeper Alisson, but saw his chipped effort cleared off the line by Alexander-Arnold. An ensuing attempt from Nikola Vlasic was deflected away from goal.
David Moyes' side had another chance to level the scores on 69 minutes when Manuel Lanzini received the ball in space with only Allison to beat, but he blazed the ball over the bar.
Saturday's victory means Liverpool have cut the gap to just three points behind leaders Man City, who play Manchester United on Sunday.
Liverpool defender Virgil Van Djik set a new Premier League record for most home games unbeaten, extending his tally to 60 since making his debut in 2018.
The record was previously held by former United winger Lee Sharpe, set a quarter of a century ago.