Fernando Torres scored twice as Liverpool held off a brave fightback from West Ham to earn a deserved victory in a five-goal thriller at Upton Park.
Torres put the Reds in front in the 19th minute with a fine solo goal but debutant Alessandro Diamanti levelled from the penalty spot.
Dirk Kuyt restored Liverpool's lead in the 40th minute but Carlton Cole levelled again a minute before the interval.
But the irrepressible Torres settled a pulsating contest when he headed home from close range in the 75th minute.
The victory, Liverpool's fourth successive win, lifted Rafael Benitez's side into third place in the Barclays Premier League and left West Ham in 14th.
The first half was full of incident and it was the home side who squandered a great chance to take the lead in the second minute.
Liverpool defender Jamie Carragher dithered over Glen Johnson's pass and let Zavon Hines in.
The striker could not have asked for a simpler chance but although he beat Jose Reina, his shot hit the near post before the Spanish goalkeeper gratefully gathered the rebound.
Another Carragher mistake on the halfway line gave Cole room to run at the Liverpool goal but this time Martin Skrtel made a wonderful saving challenge.
In the 15th minute the home team had another chance, Cole bundling the ball to Hines from Julien Faubert's cross but the chance came too quickly and Hines' connection was minimal.
Torres, meanwhile, acrobatically volleyed wide after 17 minutes before opening the scoring three minutes later.
The Spaniard broke down the left flank, bamboozled James Tomkins and poked home at the near post.
Torres was proving to be a real thorn in West Ham's side and was confident enough to try his luck from 30 yards in the 26th minute but his shot was far too high and failed to trouble Green.
West Ham's woes continued moments later when Valon Behrami was forced out of the action through injury and replaced by Radoslav Kovac.
It was the second enforced change for Gianfranco Zola's side who lost Matthew Upson earlier in the opening half.
But the home side were back in the game in the 28th minute when referee Andre Marriner adjudged that Hines had been pushed by Carragher in the box.
Alessandro Diamanti stepped-up to take the penalty and even though he put the ball into the net, the striker appeared to slip as he connected with the ball and touched it twice.
Angry Liverpool players protested that the penalty should be ruled out as Diamanti had touched the ball more than once but Marriner rejected their protests.
But Liverpool went back in front five minutes before the end of an eventful opening 45 minutes.
An outswinging corner from Yossi Benayoun was headed towards the far post by Steven Gerrard only for Kuyt to stick out a foot and poke the ball into the corner of the net in the 40th minute.
But a minute before the half-time whistle, England striker Cole rose highest in the six-yard box to meet Mark Noble's corner and head the Hammers level for the second time in the game.
Hines was giving Liverpool's defence a great deal of cause for concern.
Javier Mascherano could only bring the winger down in the 49th minute and his mistimed tackle earned the Liverpool player a yellow card.
A rare West Ham corner in the 59th minute almost caught out the Reds.
Debutant Diamanti sent an inswinging corner into the Liverpool six-yard box and Reina had to tip the ball away for another flag-kick as it threatened to end up in the net.
Liverpool replaced goalscorer Kuyt with Ryan Babel on the hour as the Merseysiders searched for a winner.
A fabulous run into the West Ham penalty area by Benayoun almost brought Liverpool a third but the home defence cleared the ball at the last hurdle.
West Ham were suffering from the lack of a killer final ball. Kieron Dyer, on for Diamanti, made a superb run deep into the Liverpool half in the 68th minute but he could not supply the final ball to put Cole clear.
Liverpool's Babel tried his luck from 25 yards but his accuracy was found wanting as the ball went high over the bar and into the crowd.
But the Reds clinched the game in the 75th minute when Babel's cross was headed into the corner of the net by Torres from eight yards.
Kovac was then denied at the death by a brilliant Reina save.Reuse content