Liverpool got off to the perfect start at St James' Park as an unmarked Virgil van Dijk headed home from a Trent Alexander-Arnold corner but Christian Atsu cancelled out their opener just seven minutes later.
There was a slice of luck about the hosts' equaliser on 20 minutes as Javier Manquillo's cross bypassed Salomon Rondon and was picked up by Matt Ritchie.
Ricthie miscued his effort but it reached the Venezuelan striker, with Atsu slamming the ball into the net on the rebound after Rondon's effort was cleared off the line by Alexander-Arnold's elbow.
The goal gave Newcastle confidence and Manquillo saw an effort well saved before Ayoze Perez rattled the crossbar with visiting keeper Alisson beaten.
Liverpool were under pressure but moments after Perez's near miss they reclaimed the lead thanks to a Mohamed Salah strike.
Daniel Sturridge backheeled the ball to Trent Alexander-Arnold, he found Salah with a cross and the forward guided the ball home from close range with a deft touch.
Martin Dubravka made a key save to deny Sadio Mane with 10 minutes of the first half remaining as Newcastle's momentum was halted by Liverpool’s second, with the Reds taking a 2-1 lead into the break.
Liverpool looked the more likely after the restart and Daniel Sturridge should have doubled their lead but fired over when well placed before Jordan Henderson saw a shot blocked.
On 54 minutes it was Newcastle's turn to grab a goal against the run of play, but it was a moment of real quality as Rondon's strike giving Alisson absolutely no chance.
Liverpool could only half clear a corner, and Manquillo headed the ball back in towards Rondon.
The striker let the ball bounce before firing home a powerful strike to level matters.
Jurgen Klopp brought on Xherdan Shaqiri and Divock Origi after Rondon's equaliser and the two combined for the winner.
With just four minutes remaining the away side won a free kick, Shaqiri sent the ball into the area and Origi beat Jamaal Lascelles in the air to head past Dubravka.
Liverpool move back to the top of the league but Manchester City will reclaim top spot if they overcome Leicester at the Etihad Stadium on Monday.
Klopp's men complete the campaign at home to Wolves next Sunday and City travel to Brighton.