England arrived on day four with backs-to-the-wall defiance apparently the best they could hope for after conceding a 134-run first-innings deficit to New Zealand.
But Cook (153no) did his job so well, wonderfully supported by Joe Root (84) but then most memorably by Stokes (101), that on 429 for six at stumps the hosts could start to think about pushing for a Bank Holiday win rather than a battling draw at the start of their Ashes summer.
When the captain’s overnight partner Ian Bell departed to the third ball of the morning, England were still 60 runs behind with three wickets down.
But Cook combined in a stand of 158 with Root, completed his 206-ball hundred – and then largely watched from 22 yards as Stokes smacked 78 of the next 100 runs in a partnership of 132 in just 26 overs.
After tea in particular against the second new ball, Stokes took on the Kiwis and hooked Tim Southee for two sixes and a mishit four off successive balls as 20 came from one over and then another 17 in the same bowler’s next.
Stokes drove brilliantly down the ground too, and hit 15 fours and three sixes in his 85-ball century – England’s fastest since 1902 and the fastest Test century on this ground by any player.
It was also the Durham all-rounder’s second Test ton of his career and came just three days after he fell agonisingly short with 92 in the first innings here.
Cook had dealt most impressively with New Zealand’s swing exponents Southee and Trent Boult, and Root milked the off-spin of Mark Craig – who leaked runs to the sweep.
After Bell followed some swing down the slope from Southee to be caught behind, the onus was squarely on England’s captain and vice-captain to keep their team in the match.
Bell’s failure to add to the 29 he had to work so hard for under cloud cover the previous evening extended a sequence of 41 runs in six innings since his century in Antigua last month.
Cook, by contrast, was back to his best following his long overdue hundred in Barbados in a chanceless innings which has taken him to within only another 41 of surpassing his mentor Graham Gooch as England’s all-time record Test runscorer.
Root was less convincing initially, and needed a little more fortune – notably on seven when he chipped aerially to a cunningly deployed square leg but was reprieved by third umpire Rod Tucker, who concluded the ball had not quite carried to Corey Anderson off Boult.
That was as close as the Kiwis came to a second breakthrough until deep into an increasingly cloudy afternoon.
Cook took England into credit with a cut for four when Craig dropped short in his first over, and the prolific Root accelerated past an eighth 50 in his last 10 Test innings. Yet just when it seemed twin centuries had become a formality, Root missed three figures for the second time in the match when he greeted the return of Matt Henry by pulling the third ball of a new spell straight to deep fine leg.
He had hit 12 fours from 139 balls, but left England still needing plenty more.
Cook, however, needed no one to tell him that – and having celebrated his century with uncharacteristic vigour, he made sure too he stayed in the equation.
Stokes had begun to show his hand by the time rain brought a slightly early tea – but not to compare with what followed in the evening when no boundary was safe until he edged an attempted big hit at Craig to slip.
Even then there was work to do for Cook to ensure the heroics to date were not in vain.
Jos Buttler edged Henry behind on the back foot for 14, but the captain stood firm to bat throughout the day and be centre stage to dictate events again today.