Having restricted the tourists to 340 for six following four wickets for Tom Curran, England once again appeared to be cruising to their target with minimal fuss on what was yet another belting pitch at Trent Bridge.
Roy struck 114 from 89 balls, piling on 201 runs for the first two wickets as Pakistans fielding came apart at the seams. But when his departure in the 28th over triggered a collapse of four wickets in 22 balls, the fourth ODI suddenly turned into a dog fight.
Stokes, fresh to the crease, needed to show significant composure. Despite making 37 during Tuesdays win at Bristol – his only innings of the series – the all-rounder had returned from the Indian Premier League down on form with both bat and ball.
Pakistan might have been heading up the M1 for Sundays series finale in Leeds with a deficit of 2-1 had they appealed when Sarfaraz Ahmed removed the one remaining bail with Tom Curran, then on seven, short of his ground. Curran went on to score 31 in a vital stand of 61 with Stokes.
He needed allies too. Joe Denly came first, adding 42 for the sixth wicket but falling victim to a superb caught and bowled from Junaid Khan on 17, before Curran hustled 31 runs in a stand of 61. The No8 enjoyed a stroke of fortune on six, however, when Sarfraz Ahmed failed to appeal for a run out, under the belief the stumps had already been broken by an initial direct hit. In fact, one bail remained and Curran, just short of his ground, should have gone under the laws.
With this pairs support, Stokes compiled an unbeaten 71 from 64 balls – one of five fours and three sixes – steering England over the line for a three-wicket win with three balls remaining and Adil Rashid for company.
At the time, I thought both bails came out. We didnt appeal, confirmed Sarfaraz, of the run-out incident in which he disturbed the stumps prior to collecting the ball. Law 29.2 states that one bail is sufficient when putting the wicket down.
Jos Buttler, captaining the side to a 3-0 scoreline while Eoin Morgan served a one-match ban, said: It was good to get there in the final overs. We were under pressure but Ben and Tom, that was a great partnership.
On Curran, whose supporting role with the bat followed figures of four for 71, he added: Every time somethings asked of him he comes up with the goods.
Im not in the form of my life. It was not my most fluent of innings but it was an extremely special feeling get over three figures. I didnt see it coming, the 28-year-old said.
Curran certainly came up with the goods in the first innings, repeatedly puncturing holes in the Pakistan batting lineup – including twice at the end – to push his case for Tuesdays final World Cup squad. The identity of the fall guy is scarcely any clearer either, given Mark Wood also impressed with two strikes in his first outing since the Caribbean tour.
This related chiefly to Woods speeds, which topped 90mph three times in his first over and then sent Imam-ul-Haq off to hospital in his second when a lifter crashed into the openers elbow.
While his late dismissal of Shoaib Malik was bizarre – the veteran hit his own stumps attempting a late cut on 41– the removal of Mohammad Hafeez for 59 in the 37th over, clouting a rasping short ball to mid-on, was pivotal.
Hafeez and the elegant Babar Azam had put on 104 for the second wicket, having come together for the 21st over after Curran had removed Fakhar Zaman for 57. The pair should have gone harder, not least Babar who went 10 overs without a boundary before a tickle down leg for four brought up his ninth ODI hundred.
Coming from 104 balls, it was the slowest of seven ODI centuries in Nottingham in the past four years and needed some late thrust to compensate. This was not forthcoming, however, with a Curran slower ball leading to Jofra Archer holding a catch on the sweeper boundary.
It is Archers emergence that has created Englands selectorial bottleneck. On a relatively quiet day for the newcomer he nevertheless combined with Wood for an average speed of 88mph in their initial eight overs – Englands fastest opening spell since the advent of speed guns – and removed the dangerous Asif Ali for 17.
Stokes was subdued with the ball while Rashid and Moeen Ali took some punishment (even if the latter was denied the wicket of his tormentor, Hafeez, when Buttler fluffed a stumping chance).
Denly was surprisingly the thriftiest on show, coming on in the opening power play and sending down five overs for 27.
Roys eighth one-day hundred looked to have broken the back of the chase. As well as scorching to three figures in 75 balls – bringing up his hundred with an astonishing backfoot punch for six over extra cover – he put on a 94-run opening stand with James Vince (in for the rested Jonny Bairstow) and 107 with Joe Root.
His eventual demise came when gloving down the leg side off the slippery Mohammad Hasnain and sparked Englands collapse. Root, already handed a life on 33, edged to short third man off Imad Wasim before the left-arm spinner had Buttler caught at short fine-leg for a second-ball duck when attempting a sweep.
When Moeen spooned a catch to mid-wicket trying to flay Shoaib to the rope third ball, England were suddenly 216 for five in the 31st over and in desperate need of a cooler head. Thankfully Stokes, not always known for this, delivered.
England survived a scare to win the fourth one-day international against Pakistan by three wickets and wrap up the series with a game to spare.
Jason Roys century had the home side coasting their chase of 341, only for his dismissal to spark a collapse of four wickets for 15 runs.
But Ben Stokes made 71 not out and Tom Curran, who should have been run out on seven, 31 to get the hosts over the line with three balls to spare.
In perfect batting conditions on the Trent Bridge ground where England have racked up the two highest ODI totals of all time, Pakistan posted 340-7.
Babar Azams controlled 115 was the mainstay yet, even with England missing suspended captain Eoin Morgan and rested opener Jonny Bairstow, the visitors total did not feel like it should have posed a challenge.
That England were ultimately tested can only be good for their World Cup preparations and winning with a much-changed side – Chris Woakes, David Willey and Liam Plunkett were also rested – further demonstrates the depth of their squad.
England take an unassailable 3-0 lead in the five-match series, which concludes at Headingley on Sunday.
England were put under pressure in the second match of the series, when Pakistan almost overhauled 373 in Southampton, but they dominated the third match in Bristol.
As far as their World Cup build-up goes, this was a new examination as they recovered after wobbling in a run-chase.
In addition, it was a welcome return to form for Stokes, who struggled with bat and ball at the end of the IPL and has not yet taken a wicket in this series.
With England needing 125 from 19.4 overs, Stokes first shared 42 with Joe Denly and then, crucially, 61 with Curran, who earlier claimed 4-75 with the ball.
There was a bizarre moment when Curran should have been run out, only for Pakistan not to appeal despite the Surrey mans bat being on the crease line when the bail was removed.
Both Stokes, who struck three sixes, and Curran peppered the square boundaries, until Curran was bowled by Hassan Ali in the 48th over.
Adil Rashid joined Stokes with 19 needed from the final two, but Junaid Khans 49th was taken for 16 and Stokes won it from the third ball of the final over.
For long periods it looked like Roy would lead England to overhaul a massive total with impunity, just as Bairstows century was the catalyst for a comfortable chase of 359 in Bristol on Tuesday.
He was dropped on 25 by Fakhar Zaman, one of a number of early Pakistan mistakes in the field, and scored all around the wicket – his four sixes were close to being the points of a compass.
After he reached his eighth ODI hundred from 75 balls with an incredible maximum over cover, even a double century seemed possible, but when he gloved an attempted pull off Mohammad Hasnain, the fortunes of both sides were reversed.
Root was well caught at short third man by Mohammad Hafeez off Imad Wasim, stand-in captain Jos Buttler swept the same bowler to short fine leg for a two-ball duck and Moeen Ali sloppily miscued Shoaib Malik to mid-wicket.
As the battle for pace-bowling spots in Englands World Cup squad continues, much intrigue surrounded the Nottingham new-ball pairing of Mark Wood and Jofra Archer, the fastest bowlers at the hosts disposal.
With both bowlers regularly touching 90mph, there was an extra dimension to an attack that, at times in this series, has looked one-paced.
Indeed, Wood hit Pakistan opener Imam-ul-Haq on the elbow and forced him to retire hurt. Later, he also rattled Imad Wasims helmet whilst Archer bounced the returning Imam.
In between, Babar guided Pakistan with his composed century, adding 107 with Fakhar and 104 with Mohammad Hafeez, who both made half-centuries.
However, in such excellent batting conditions, there remained the suspicion that the tourists lacked the intent to get to a total that was going to defeat England.
Not only that, but they were kept in check by the home sides fielding and Curran, who boosted his own World Cup hopes with yorkers and slower balls even before his effort with the bat.
Former England captain Michael Vaughan: “This game almost been the perfect scenario for England: to be put under this pressure with their key all-rounder not out at the end having not been in good form.
“Ben Stokes – he hasnt been playing well – needed time in the middle, in a tight situation, where the balance had swung to Pakistan winning and he took England home with some good blows.
“If their fielding can get to a reasonable standard – some of the fumbles werent even amateurish – I have seen enough that they will threaten a lot of teams in the World Cup.”
England captain Jos Buttler on TMS: “It was a very good win. For the large majority of the game we were very good.
“We had a really poor couple of overs with the bat which is disappointing but for Ben Stokes to be there at the end having a great partnership with Tom Curran was good for us.
“I think the bowlers did brilliantly today. 340, as silly as it sounds, was a few under what we could have been chasing after Pakistan got off to a great start. We have seen scores getting higher and higher. 340 wasnt a massive score to chase today.
“It [final World Cup squad] is a really tough decision for the guys to have to make but what is great for us is guys standing up. Tom Curran had a fantastic all-round day today.”