Luis Suarez scored twice as Liverpool recorded their first victory at Stoke in the Premier League to move five points behind leaders Manchester City.
They took a 2-0 lead in the first half following an own goal from Ryan Shawcross and a strike from Suarez.
Stoke hit back through a Peter Crouch header and a superb Charlie Adam shot.
Steven Gerrard made it 3-2 from the spot and Suarez fired in an angled shot before Jon Walters's strike, but Daniel Sturridge sealed the win late on.
Rodgers proud of 'brilliant' win
That last goal came with three minutes of the 90 remaining, which still was enough time for Crouch to head against the post and for Simon Mignolet to produce an outstanding save to prevent Gerrard from scoring an own goal.
In total, there were 13 efforts on goal from each side at the Britannia Stadium, a venue where Stoke had only conceded seven goals in their previous 10 league fixtures.
Liverpool manager Brendan Rodgers will be bemoaning his side's defending, as will opposite number Mark Hughes, but the Irishman will be thrilled by the reunion of Sturridge and Suarez in attack.
Liverpool have conceded at least two goals in seven of their last eight Premier League away games
England international Sturridge, who had not played because of an ankle injury since 23 November, came on in the 66th minute and five minutes later provided the assist for Suarez's second.
And with three minutes remaining, the Uruguay forward found his partner, who then scored the fifth as the Reds climbed from sixth to fourth.
Liverpool began brilliantly and were in cruise control up until six minutes before the break. Shawcross inadvertently found the net after Aly Cissokho's drive took a huge deflection off his leg, before Suarez capitalised on errors from Marc Wilson and the goalscorer to slot in the second.
Stoke's riposte to going two goals down was commendable. They reduced the arrears when Austrian winger Marko Arnautovic, in the team for the ineligible Oussama Assaidi, flung in a ball from the left which Crouch guided into Mignolet's bottom right.
They then levelled in spectacular style when another ex-Red, Adam, drove forward and launched a ferocious shot from 20 yards that easily beat the Belgium keeper.
However, Liverpool were back in front six minutes after the restart.
Once again it was a defensive mistake - and once again it was Wilson. The Republic of Ireland defender, in an attempt to find a team-mate, played the ball to the effervescent Raheem Sterling.
Sterling went down too easily - Hughes
The Liverpool winger, who seemed to control the ball with his hand, sped into the area before he was pushed over by Wilson, who was trying to atone for his initial mistake.
Captain Gerrard, who was playing in a holding midfield role on his 650th appearance for the club, slotted in his spot-kick to Jack Butland's left.
And Liverpool twisted the knife once more when substitute Sturridge jinked one way then the other before playing in Suarez, who smacked an angled drive that nestled in the bottom left.
It should have been game over, but there was still time for one more Stoke response when Walters was quick to pick up the loose ball in the area before firing in past the reach of Mignolet.
With Stoke pouring forward in search of an equaliser, they were left exposed at the back allowing Suarez to break and find Sturridge.
The ex-Chelsea player's initial strike was saved by Butland, but he stayed alert to pick up the follow-up, juggle the ball and fire in at the far post.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.