Arsenal's late surge had put Juergen Klopp's side under immense pressure but they responded in style and will definitely finish in the top-four if they beat relegated Middlesbrough at Anfield on the final day of the season next Sunday.
Anything other than a victory at West Ham's London Stadium would have left Liverpool relying on other results going their way but once Daniel Sturridge put them ahead in the 35th minute they were relatively comfortable.
Coutinho struck twice in the space of four minutes midway through the second half and Divock Origi rubbed salt into West Ham's wounds as the visitors ran riot.
Liverpool have 73 points with one match remaining, one ahead of Man City and four more than Arsenal who both have two games left to play.
Until England striker Sturridge, making his first start since Jan. 3, opened the scoring Liverpool had seemed nervy as West Ham looked intent on putting a spanner in their top-four hopes.
West Ham's Sam Byram wasted a golden chance early on, shooting wide after being played clear by Manuel Lanzini.
Joel Matip struck the underside of the crossbar for Liverpool, who took the lead when Coutinho's defence-splitting pass sent Sturridge clear and he left keeper Adrian grounded with a neat stepover before sliding the ball home.
Liverpool survived a scare when Andre Ayew somehow struck the post twice in the space of seconds just before the interval.
Klopp's side could breathe easy though when Coutinho fired in a rebound after 57 minutes after Georginio Wijnaldum's shot cannoned back off the woodwork. Four minutes later Coutinho made the points safe after a counter-attack with West Ham furious that a handball had gone unpunished in the build-up.
Divock Origi steered in Liverpool's fourth as the visiting fans celebrated a likely return to Europe's elite competition.
Enter a name and e-mail address and we will e-mail this website link too them.