The Portuguese linked up brilliantly with fellow substitute Xherdan Shaqiri five minutes from time to ensure the defending champion denied its in-form opponent a share of the points.
Liverpool was forced to come from behind after Pablo Fornals's well-taken early goal, which was cancelled out by Mohamed Salah's penalty moments before the break.
The turnaround helped Jurgen Klopp's men prevail as they extended their unbeaten league run at Anfield to 63 games, equalling a club record streak set between February 1978 and December 1980.
As expected, Liverpool started the game by taking complete control of possession, probing a penned-in West Ham defence.
But after holding firm throughout their early examination, the visitors showed that they only needed one chance to get on the scoresheet, Fornals latching on to a poor Joe Gomez clearance and steering the ball in off the post.
Indeed, the Hammers were the best side for large parts of the first half, finding their way deep into opposition territory with worrying regularity from the hosts' perspective.
Still, they could not entirely manage the Liverpool threat and, with a half-time lead seemingly in the bag, conspired to give away a penalty as Arthur Masuaku clumsily clipped Salah, who converted from the spot.
Despite that setback, the Hammers' first-half performance meant they had every reason to come out for the second period brimming with confidence, and they wasted little time in underlining their ambition after the restart as Masuaku's cross was almost poked home by Fornals.
With Liverpool still struggling to find its cutting edge by the 70th minute, Klopp looked to the bench, introducing Shaqiri and Jota.
The Reds manager thought that move had paid off handsomely when the latter turned the ball home after Sadio Mane had been denied from close range.
However, a VAR (video assistant referee) check showed the Senegalese to have fouled goalkeeper Lukasz Fabianski in following the ball in, prompting referee Kevin Friend to chalk the goal off after checking replays.
Jota would simply have to wait a little longer for his big moment, with an inch-perfect Shaqiri ball setting him up to thrash the ball home at the Kop end with five minutes remaining.