Liverpool are on 79 points with Manchester City, who won at Fulham on Saturday, on 77 points but with a game in hand.
Spurs keeper Hugo Lloris parried out a back post header from Mohamed Salah but the ball struck the unfortunate Belgian central defender and rolled over the line in the 90th minute.
It was a stroke of luck for Liverpool and one which sent Anfield wild with relief as a draw would have handed the advantage in the title race straight to Pep Guardiola's side.
Questions will be asked of Lloris's failure to smother the ball or push it away from danger but it was a cruel end to a strong second half display from Tottenham who are now level on 61 points with fourth-placed Manchester United.
"There are 500,000 different ways to win a football game – and today it was rather ugly, but no problem," said Liverpool manager Juergen Klopp.
"We take that. Without a bit of luck you cannot be in the position we are in, it’s not possible," he said.
Roberto Firmino opened the scoring in the 16th minute getting between the Spurs central defenders to meet a perfectly shaped cross from left-back Andy Robertson with a firm header.
Klopp's side looked to quickly add a second but while they roared forward and had Tottenham's defence shaking, their shots on goal were limited.
Tottenham recovered and were well on top after the break. It was no surprise when they drew level - Harry Kane swinging a wonderful cross-field pass to Kieran Trippier whose low ball was flicked on by Christian Eriksen and Lucas Moura drove home the loose ball.
Spurs could have made it even worse for Liverpool five minutes from the end but Moussa Sissoko, looking far from composed, blasted over at the end of a dangerous counter-attack.
Then came the late winner - a half-cleared corner was collected by Robertson and Trent Alexander-Arnold launched a deep shot to the far post. Salah's header was pushed out by the French keeper against Alderweireld's shins and into the net.
Spurs manager Mauricio Pochettino was deflated by the loss but said he was pleased with his team's display.
“We reacted well, dominated in the second half and played much better, created chances and should have won the game,” he said.
“We’re disappointed, very disappointed, but we keep going. Sometimes you need to accept that football is cruel, but never give up because we are in a good position and this performance makes me feel very optimistic," he said.