England were denied a Royal London One-Day Series whitewash after Pakistan chased 303 to win by four wickets in Cardiff.
Having won all four matches before crossing the Severn Bridge for the final ODI, England had high hopes of a famous five in the Welsh capital.
But Pakistan, with Sarfraz Ahmed and Shoaib Malik outstanding in their partnership of 163, combined to inflict England’s first white ball defeat this summer.
England looked favourites when Mark Wood struck twice in three balls to peg the tourists back to 77 for three.
The pugnacious Sarfraz, impressive all summer, then made the game’s telling contribution – 90 from 73 balls – to seize the initiative.
A second ton of the series looked a certainty until he attempted one big shot too many off debutant Liam Dawson; Alex Hales claiming the catch to give the Hampshire spinner his first ODI wicket.
Malik perished in similar manner, caught in the deep off Dawson, as Pakistan threatened to implode.
England sensed an unlikely victory when Jonny Bairstow brilliantly ran out Mohammad Nawaz but Mohammad Rizwan and Imad Wasim kept their cool to chalk up Pakistan’s first win of the series with ten balls remaining.
Inserted under grey skies, England found themselves 92 for three before Jason Roy and Ben Stokes combined to add 72 watchful runs.
Roy, one of England’s white ball stars this summer, looked on course for his third ton until he pulled Mohammad Amir to Hasan Ali on the square leg boundary.
Fresh from their 103-run stand in the victory at Headingley on Thursday, Stokes and Jonny Bairstow added 55 before the latter guided a short ball from Gul to backward point for 33.
Stokes, who took a while to hit his stride, would also have been eyeing three figures – he’s yet to make a white ball hundred for England – but having made a run-a-ball 75 he scooped Ali to Umar Gul.
England then lost a succession of quick wickets and finished on 302, while Pakistan chased down thanks largely to Shoaib and Sarfraz's sizeable stand.
Swansea-born Imad Wasim was the one who eventually saw Pakistan over the line, along with Mohammad Rizwan. He hit a four off Chris Jordan through mid-on to claim a four-wicket triumph for the tourists, who ensured the series finished 4-1 to England.
Sarfraz Ahmed was awarded the Man Of The Match award for an incredible innings of 90, while England's Joe Root was rewarded for his consistent displays with the Man Of The Series award. England and Pakistan now head to Old Trafford for a single international T20 encounter.