Pakistan 304 for 6 (Sarfraz 90, Malik 77) beat England 302 for 9 (Roy 87, Stokes 75, Hasan 4-60) by four wickets
Scorecard and ball-by-ball details
Pakistan achieved their sixth-highest successful ODI chase to avert a whitewash at the hands of England in Cardiff. Sarfraz Ahmed led the way with 90 from 73 balls during a record fourth-wicket stand for Pakistan against England as he and Shoaib Malik finally provided the fibre lacking through so much of the series for the tourists to help overhaul a target of 303 with four wickets and 10 balls to spare.
No team had previously chased 300 to win in Cardiff but England, having rotated their bowling attack, suddenly found themselves stretched. The decision to leave out both frontline spinners, Moeen Ali and Adil Rashid, was a risk that Pakistan capitalised upon in particular, as the debutant Liam Dawson returned figures of 8-0-70-2, having been targeted from the outset as Sarfraz struck his first two balls to the boundary.
Dawson did eventually remove both to wild slogs down the ground and at 256 for 5 England sensed an opportunity to put pressure on a nervous Pakistan side that had only won once, against Ireland, in their previous ten completed ODIs. Malik's dismissal for 77 one ball after hitting Dawson for a straight six was particularly heedless but, despite a direct hit from Jonny Bairstow to run out Mohammad Nawaz, the inexperienced pairing of Mohammad Rizwan and Imad Wasim held their nerve.
England had lost 5 for 64 during the closing stages of their innings but still just about managed to fight their way up beyond 300, setting Pakistan a target some way in excess of the previous best on the ground. Jason Roy and Ben Stokes were both unable to convert hundreds when seemingly well set for England while Mohammad Amir and Hasan Ali, bowling intelligently at the death, shared seven wickets.
Given the respective levels of confidence in the two dressing rooms, it looked like it might be enough. Sharjeel Khan, Pakistan's most powerful striker, chipped to mid-on in the fifth over of the chase and Mark Wood then struck twice in an over to remove both set batsmen after a 54-run partnership between Azhar Ali and Babar Azam. Having gone wide on the crease to get Azam, bowled through the gate, England then used the DRS to overturn a not-out decision and have Azhar caught behind.
The 163-run association between Sarfraz and Malik turned the game around. It was Pakistan's first century partnership of the series and they became increasingly comfortable after coming together with the score on 77 for 3. Sarfraz was the more aggressive, reaching his half-century from 44 deliveries, while Malik passed 50 in England for the first time in any format.
They had only just pushed Pakistan's score into three figures when Dawson was called upon to bowl for the first time in ODIs. Sarfraz swept his first ball to deep backward square and then advanced nimbly to drive through midwicket to immediately throw down the gauntlet. By the time Dawson finished a spell of four overs at a cost of 41, Pakistan at last had a spring in their pajama-trousered step and were more than halfway to their target.
An exceptionally tough one-handed chance to Joe Root at extra cover when Malik had 9, and a failed review for lbw against Sarfraz - trapped in front on 60 by a Wood slower ball that Hawk-Eye suggested had bounced too much - were as close as England came to separating the two most battle-hardened members of the Pakistan batting order when it mattered. Even though Sarfraz departed ten short of a century with 63 still required, the tonic had worked.
Pakistan's bowlers had struck regularly through the first innings to ensure that England, who were well placed at 219 for 4 in the 38th over, did not set an even more challenging target. There was some turn for the spinners and Imad - a Wales-born Pakistani playing in front of a home crowd of sorts - bowled well for figures of 1 for 33 but the efforts of Malik and Nawaz, whose combined 10 overs went for 72, foreshadowed how Pakistan would later target Dawson.
Azhar had won what looked like being a helpful toss on a cool, overcast morning and Amir found some swing in his opening over to trouble Roy, who could have been out lbw to his third ball, which pitched on leg and was umpire's call on impact and hitting the stumps. The next delivery found Roy's inside edge but brought him a boundary to fine leg and England rode their luck to reach 37 in the fifth over when Amir finally collared Alex Hales, who chipped a slower ball to mid-on.
Root and Eoin Morgan fell cheaply to leave England on 92 for 3 and there were some tricky moments for Roy and Stokes to negotiate against the turning ball. Stokes was beaten in the flight by a delivery from Imad that spun inside his bat but also defeated Sarfraz with a stumping at his mercy and the same batsman survived a review for lbw, with the ball shown to be pitching just outside leg stump before skidding under an attempted reverse-sweep.
Roy went to his second fifty of the series, from 49 balls, with a top-edged reverse-sweep that flew past a lumbering Umar Gul at short third man and then, on 56, saw Rizwan only get fingertips to a leg-side flick. He then began to open up, twice hitting Malik for straight sixes that threatened to give the ball a dunking in the River Taff, but was never entirely able to cut loose on a surface that offered some grip throughout. With a fourth ODI hundred beginning to come into view he impatiently pulled the returning Amir straight to deep square leg.
That ended a partnership of 72 for the fourth wicket; the first 50 had seen Stokes contribute just nine singles. He did not hit a boundary until his 33rd delivery, which he then muscled down the ground in imposing fashion, and Nawaz was again dumped unceremoniously over the short straight boundary a few overs later. Stokes had a few moments of discomfort - not least when bottom-edging a pull into his protective box - but produced flashes of power to go past the 70 he scored batting at No. 3 in Perth on England's best-forgotten 2013-14 tour of Australia.
But Pakistan continued to take wickets and, after Bairstow ramped to short third man for a lively 33 in another fifty stand, the debutant Dawson came out at No. 7 with more than 12 overs left. He was unable to make much of an impression with the bat and a torrid introduction was to follow with the ball as England, chasing only a second 5-0 whitewash in bilateral ODI series, faltered at the last.
Alan Gardner is an assistant editor at ESPNcricinfo. @alanroderick