Liverpool had to come from behind to tie Manchester City's record of 18 consecutive Premier League wins, dramatically edging West Ham 3-2 at Anfield.
It looked set to be a straightforward evening for the leaders when Georginio Wijnaldum headed in the opener on nine minutes.
But Issa Diop equalised shortly afterwards, and on 54 minutes the home crowd was stunned as substitute Pablo Fornals turned the visitors in front.
The noise soon went up a notch, and a Lukasz Fabianski error allowed Mohamed Salah to restore parity before Sadio Mane struck the decisive blow 10 minutes from time.
Victory maintains Liverpool's 22-point advantage and leaves them just four wins from the title.
Story of the match
The now-customary chants of 'We're gonna win the league' reverberated around Anfield very early indeed, with a richly enjoyable cruise to victory expected following Wijnaldum's effort.
Trent Alexander-Arnold dug out a brilliant cross from near the byline on the right-hand side, and the Dutchman connected, finding the net for the first time since November via a touch from Fabianski.
But West Ham were not dispirited, and after a succession of corners, it was all-square as Diop nodded home virtually unopposed at the front post. Alisson may have felt he could have clawed it away.
There were opportunities at both ends in what remained of the first half - Salah saw a shot superbly tipped over, Alisson grabbed the ball at the feet of Michail Antonio and Roberto Firmino curled one wide - but Virgil van Dijk went closest of all, crashing a header onto the crossbar from a 40th-minute corner.
Moyes introduced Fornals in place of Tomas Soucek just two minutes into the second period, and his decision bore fruit.
Declan Rice picked out the unmarked Spaniard from the right, and he mishit the ball into the bottom corner to send the away end into a frenzy.
And then they braced themselves, for a Liverpool rally was imminent. Alex Oxlade-Chamberlain entered the fray and invigorated his side, powering a long-range effort just wide in one of his first contributions.
Mane was thwarted by Jeremy Ngakia after being set through, then a sumptuous Alexander-Arnold drive was palmed away by Fabianski.
In the end, an error from the usually reliable Pole cost West Ham their hard-earned advantage. Andrew Robertson found his way into the danger zone down the left and cut the ball back to Salah, whose tame, central shot slipped between the goalkeeper's legs.
Liverpool very nearly completed the turnaround within five minutes as Fabianski's save from Salah looped up to Firmino, stationed almost on the goal-line, but he inexplicably headed against the post.
Yet from the moment they equalised, a winner seemed inevitable, and it arrived after 81 minutes in somewhat fortuitous circumstances.
Joe Gomez tried his luck from range, and after a block, the ball fell kindly for an opportunistic Alexander-Arnold, who dinked in a cross for Mane to easily finish at the back post.
Mane thought he'd made sure of the points soon after, when the same combination struck again, but this time he had strayed marginally offside.
And hearts were in Liverpool mouths on two occasions before the end. First, substitute Jarrod Bowen was slipped in-behind the Reds' defence and was heroically denied by Alisson, and then, a cleared free-kick broke for Mark Noble, who lashed one goalwards from the edge of the area. It was diverted wide, and this time the corner caused no problems. Jon Moss blew the whistle and Anfield celebrated the dogged maintenance of Liverpool's unbeaten record.
A needed jolt for Liverpool?
It was suggested in the wake of the defeat in Madrid last week that Liverpool's European ambitions might suffer if they proceed to win the league at a canter, for their sharpness would naturally be lost.
But here, they came alive - of necessity. Twice West Ham punished uncharacteristic defensive lapses, ending a run of home clean sheets that stretched back to December.
The Reds' massing advances ultimately proved irrepressible, and they emerge from one of their poorest performances with their air of invincibility heightened.
Ox has the edge over Keita
Naby Keita won the battle to replace the injured Jordan Henderson in midfield, but by the end of the game, it was Oxlade-Chamberlain who had cemented his place in the pecking order.
Keita had produced a reasonably good first-half display, but it was a little pedestrian at times, and Klopp turned to 'Ox' for a transformative cameo.
It paid dividends, with his venomous 30-yarder setting the tone for a markedly more aggressive and ambitious approach to the final third of the game.
He's likely earned a start for Saturday's trip to Watford.
Encouragement for Irons even as they remain in bottom three
Perhaps it was tempting for West Ham to look at the fixture list and bide their time. Saturday's proverbial six-pointer at home to Southampton punctuates a very tricky run; Arsenal, Wolves, Spurs and Chelsea follow.
The schedule thereafter is far more kind, bearing plentiful opportunities for much-needed points. But based on this performance, they will channel just as much energy into the toughest tests as they will the clashes with bottom-half rivals.
This was a real indication that they are scrapping for every possible point, and though they have nothing to show for it, they have, crucially, demonstrated a capacity for scalps and the enduring sense of belief within the camp.
Man of the match - Trent Alexander-Arnold
Two assists for the right-back to take his tally to the season for 14. He could have had more, as well a goal or two. His attacking contribution was magnificent.