The Reds, as expected, dominated possession in the early stages and they could've gone ahead through Mohamed Salah, who had gotten in behind the Hammers defence, but his effort was kept out by Lukasz Fabianski.
Sadio Mane struck midway through the half as Trent Alexander-Arnold's wayward strike from the edge of the box made its way to the far post, with the Senegal international staying onside and turning the ball into the back of the net to put the Reds 1-0 up.
West Ham dug in and limited the Reds' opportunities as the game went on, whilst they had chances of their own, notably through Pablo Fornals and then Manuel Lanzini, with the latter firing over the crossbar from eight yards out in the second half.
A combination of Andy Robertson and Naby Keita kept Michail Antonio out towards the latter stages of the half after West Ham had broken quickly from a Reds corner, with Jurgen Klopp visibly relieved on the touchline after Antonio looked favourite to find the back of the net.
Despite a nervy finish to the second half, it finished 1-0 to the Reds, who will now be looking to make it into the quarter-finals of the Champions League when they take on Inter Milan in the round-of-16 second leg at Anfield on Tuesday.