England 332 for 7 (Vince 102, Gregory 77, Rauf 4-65) beat Pakistan 331 for 9 (Azam 158, Rizwan 74, Imam-ul-Haq 56, Carse 5-61) by 3 wickets
James Vince's maiden international century led England to a stunning victory and a 3-0 series sweep in their final ODI against Pakistan at Edgbaston.
Vince's 102 off 95 balls came in a 129-run stand for the sixth wicket with the impressive Lewis Gregory, who scored 77 in just his third one-day international as the hosts pulled off the highest successful ODI run-chase at Edgbaston.
It came after Babar Azam's career-best 158 lifted Pakistan to 331 for 9. Azam shared a third-wicket partnership worth 179 with Mohammad Rizwan, whose 74 off 58 balls was pivotal in pushing Pakistan's total into territory which had previously evaded them on this tour. Imam-ul-Haq also contributed a valuable 56 and put on 92 runs for the second wicket with Azam.
Brydon Carse, like Gregory, playing his third ODI after being called into England's new-look side following a spate of positive Covid tests in the original squad, claimed five wickets, including that of Azam late in the innings.
Carse was there at the end too, striking the winning runs - a four off Shaheen Shah Afridi - as he and Craig Overton held the England innings together after the loss of Vince and Gregory.
On the eve of England's second anniversary as World Cup champions, it was a very different side which produced this fairy tale ending.
After disappointing returns from the three matches he played in England's World Cup campaign, Vince's innings saved his side after Phil Salt, Zak Crawley and Ben Stokes made starts but failed to press on.
Exquisite on the drive square of the wicket, his advance to Hasan Ali before crunching him through the covers summed up Vince's poise. He duly reached his hundred via a blistering four off Ali through the leg side, brandishing his bat and letting out an almighty roar as he watched the ball race to the boundary.
Gregory, who starred with bat and ball in the previous match at Lord's, backed up his innings of 40 there with another accomplished knock of 77 from 69 balls, including six fours and three sixes.
England needed only 62 from the last 10 overs and, so long as he and Vince remained at the crease, they looked in prime position. But when Haris Rauf accounted for both - Vince holing out to mid-off and Gregory skying to silly point, where Shadab Khan took an excellent catch running from the covers - the requirement was 38 off 43.
Rauf claimed career-best figures of 4 for 65 but Pakistan were left to rue a rash of costly fielding errors long before Overton and Carse arrived to see England home.
England's pursuit began brightly, thanks to Salt, who clubbed Afridi for four boundaries in five balls during the opening over of England's innings.
Ali had Dawid Malan caught behind by Rizwan for a duck with his second legitimate delivery, having sent down three wides to begin, and while replays raised doubt over whether Malan had laid bat on ball, the batter had already walked.
Salt continued in enterprising fashion to reach 37 off just 22 balls, but when Pakistan introduced Rauf in the seventh over, Salt fell to his first ball, clipping off the pads to Fakhar Zaman at midwicket.
Rauf then flattened Crawley's off stump to bring Stokes to the middle, but England's stand-in skipper couldn't stick around for long, despite being handed two extra lives on a platter.
Pakistan had been sloppy in the field but when Stokes hit Khan straight to Ali at fine leg, the ball inexplicably slid straight through the fielder's hands. Khan was the bowler again when Stokes picked out long-on where Shoaib Maqsood got a hand to the ball stretching to his right but failed to cling on as it dribbled away for four.
Having seen his long hop mowed over the fence at cow corner, Shadab finally removed Stokes, who attempted a slog-sweep but succeeded only in sending a narrow edge to Rizwan, who ended up having to be replaced by Sarfaraz Ahmed after being struck on the inside of his knee by a ball thrown in from the outfield.
Earlier, Pakistan had made an understandably watchful start, given their collapses in Cardiff and Lord's where they were all out for 141 and 195 respectively.
They lost Zaman for just 6, his attempted punch through the off side off Saqib Mahmood stymied by the awkward bounce and finding Crawley at slip. The team fifty took 13.4 overs and after 17 they were 59 for 1.
Coming with scores of 0 and 19 from the first two matches, Azam took 15 balls to get off the mark amid consecutive maidens from Player of the Series Mahmood. He crept to 15 off 38 but then he started to find the boundary more regularly.
Imam also entered the match in need of runs and, after 11 overs, 24 of his 26 runs had come through boundaries. He passed 2000 ODI runs in the course of his innings.
Azam unfurled a beautiful extra cover drive off Carse to bring up their fifty partnership and he punished Gregory's off-cutter over cow corner before smashing Matt Parkinson over long-off.
It was Parkinson who broke their union with a ripper that turned sharply from well outside off and clattered into middle stump.
With Pakistan 113 for 2, Rizwan arrived in typically attacking mood and he reached his half-century in 42 balls.
Azam, meanwhile, reached his 14th ODI century with a crisp cut to the boundary off Mahmood. He was dropped on 126 when he struck a Parkinson full toss with gusto to midwicket, where Carse was unable to hold what would have been a wonderful catch, and Azam went on to score 13 off the over.
Carse had Rizwan out edging an attempted pull to keeper John Simpson and then removed Maqsood and Ali cheaply. Mahmood took two wickets in as many balls when he bowled Faheem Ashraf and had Khan caught behind.
Azam finally fell top-edging Carse to Malan at cover with four balls left in the innings and Carse had Afridi caught by Vince two balls later to claim his fifth wicket.

Valkerie Baynes is a general editor at ESPNcricinfo