Chris Woakes took five wickets as England beat Pakistan by 54 runs to win the fifth one-day international at Headingley on Sunday.
Victory, in their final match before the World Cup hosts and favourites name their tournament squad on Tuesday, saw England to a 4-0 series win after the first match was washed out.
Woakes took three wickets for no runs in nine balls as Pakistan slumped to six for three in pursuit of a target of 352.
Babar Azam (80) and captain Sarfraz Ahmed (97) then kept England at bay but both batsmen were run out and any lingering hope Pakistan had went with them.
Woakes needed just three balls to have Fakhar Zaman out, caught by Joe Root at second slip, out for a duck.
Abid Ali (five) was then lbw to Woakes.
Woakes then nipped one back to have Mohammad Hafeez lbw for nought, although replays suggested umpire Paul Reiffel's verdict may have been overturned if Pakistan had reviewed the decision.
“Winning 4-0 against a very strong Pakistan team is really good for us, going into a crucial World Cup,” man-of-the-match Woakes told Sky Sports.
'Tough selection'
England will have to reduce their 17-man squad to 15 for the World Cup and captain Eoin Morgan told BBC Radio's Test Match Special: “I could pick 17 at the moment. It is going to be an extremely tough selection.”
Pakistan captain Sarfraz Ahmed, who top-scored for his side with 97, said: “Result-wise it is not ideal for the World Cup. But the way the batsman are batting we are ready for the World Cup. We have taken some positives but we need to sort out our bowling and fielding.”
After Pakistan's top-order collapse Babar carried on from his 115 in a three-wicket defeat at Trent Bridge on Friday with a 59-ball fifty. But a fourth-wicket partnership of 146 ended in frustrating fashion for Pakistan.
Sarfraz prodded at an Adil Rashid delivery and set off for a single. But wicket-keeper Jos Buttler moved quickly from behind the stumps to throw the ball to the bowler's end where Rashid, with Babar trying to regain his ground, flicked the ball onto the stumps from behind his back without looking to complete a run-out.
Rashid, in front of his Yorkshire home crowd, then dismissed Shoaib Malik with a diving left-handed catch off his own bowling.
Safaraz was denied what would have been his third ODI hundred in bizarre fashion.
Buttler, having stopped the ball with his boot, saw the rebound fall kindly to run out Sarfraz, who narrowly failed to ground his bat in time.
Pakistan were eventually all out for 297 in the 47th over.
Earlier, England were set for a huge score at 191 for two off 25 overs.
But several batsmen got themselves out, including Test skipper Root, who top-scored with 84, and Morgan, making his return to the side.
Root and Morgan put on 117 in 18 overs but it still needed tailender Tom Curran's unbeaten 29 to take England past 350.
Left-arm spinner Imad Wasim took three for 53, while fast bowler Shaheen Shah Afridi had four for 82 after striking at both ends of the innings. But the last over saw Curran hit a six and then ramp an outrageous four off successive Hasan Ali deliveries.
Morgan, back after a one-game ban for slow over-rate offences, hit five sixes — including one onto the roof of the Old Pavilion Stand off Mohammad Hasnain — before a mistimed pull off Afridi was caught by Abid.
Root was even closer to a century when he holed out off Hasnain, having faced 73 balls including nine fours.
Teams
England: Jonny Bairstow, James Vince, Joe Root, Eoin Morgan (capt), Ben Stokes, Jos Buttler (wkt), Moeen Ali, Chris Woakes, David Willey, Tom Curran, Adil Rashid
Pakistan: Fakhar Zaman, Abid Ali, Babar Azam, Mohammad Hafeez, Sarfraz Ahmed (capt/wkt), Shoaib Malik, Asif Ali, Imad Wasim, Hasan Ali, Shaheen Shah Afridi, Mohammad Hasnain