James Milner scored a 95th-minute penalty to extend Liverpool's winning run to 17 Premier League matches in a dramatic 2-1 victory over Leicester City at Anfield.
The Reds looked set to ease to victory after Sadio Mane marked his 100th league appearance for the club with his 50th goal five minutes before half-time, but Jurgen Klopp's men missed chance after chance to extend their lead.
And Leicester, having scarcely threatened, struck through James Maddison with 10 minutes remaining as Foxes boss Brendan Rodgers threatened to end the Reds' streak on his first return to Merseyside since his departure in 2015.
However, there was time for late drama as Mane won a penalty having been clipped by Marc Albrighton moments after Mohamed Salah hobbled off with an ankle issue, allowing Milner to net a last-gasp winner.
Liverpool has now triumphed in 17 consecutive top-flight matches - one short of the all-time record - and lead Manchester City by eight points in the table ahead of the champion's Sunday meeting with Wolverhampton Wanderers.
Trent Alexander-Arnold was involved in much of Liverpool's best attacking play from right-back and crafted early opportunities for Milner and Roberto Firmino, yet both were squandered.
It was a ball from Milner on the opposite flank that led to the breakthrough, though, as Jonny Evans failed to cut out a pass in behind and was punished ruthlessly by Mane, who might have had a second before the break but shot straight at Kasper Schmeichel.
Salah was denied by Schmeichel shortly after the restart and Evans deflected the ball narrowly wide off Mane, while both Firmino and Andy Robertson went close.
This profligacy set up a tense finish and Maddison looked to have snatched an improbable point as he fired under Adrian after good work from Ayoze Perez.
Salah then departed after a rugged challenge from Hamza Choudhury, but Liverpool did not give up and Albrighton tangled with Mane in the area, with a VAR check siding with referee Chris Kavanagh on the award of a spot-kick, which Milner rifled home.
The full-time whistle was greeted with scenes of jubilation from Klopp and the Liverpool supporters, while Perez appeared to clash with Robertson, prompting a melee that granted a gripping contest a suitably chaotic ending.
What does it mean? Huge win for early leaders
Leicester was the last Premier League opponent to avoid defeat at Anfield, back in January, and this had the feel of a big match from the outset as Liverpool raced out of the blocks.
In truth, the Foxes struggled to match the league leader for long periods, but Maddison's goal meant the finale was played out amid a cacophony of noise as the Reds were roared on to a vital win.
Mane the man again
This milestone match epitomised everything that makes Mane so key for Liverpool.
A left winger by trade, he turned up in the right-back position to hunt down Ben Chilwell early in the first half but was soon back in his usual berth to seize on Evans' error and slot coolly past Schmeichel. It was no surprise that he should then have a role in the winner.
Defensive errors costly
Leicester might well argue Mane should not have been awarded a penalty, but Albrighton's intervention was messy and cost his side. Evans had earlier suffered a lapse in concentration that put Liverpool in complete control.
Rodgers' men look like challenging the big boys this season but must learn errors will not go unpunished at this level.
There is an international break before the next round of Premier League fixtures, but Liverpool returns to another mammoth clash against misfiring bitter rival Manchester United. Leicester plays Burnley at home.