Stokes, Foakes centuries put England in command in second Test vs South Africa
Stokes converted his half-century into a hundred, his first the full-time Test captain.
The Proteas collapsed to 126 for eight at stumps on the second day.
Toby Roland-Jones removed all of South Africa's top four in a sensational debut display as England seized control of the third Test at The Oval.
The Proteas collapsed to 126 for eight at stumps on the second day, with Middlesex paceman Roland-Jones taking four wickets for 39 runs in 11 overs in what is the 100th Test at The Oval.
South Africa were 227 runs adrift after all-rounder Ben Stokes's century against an attack without the ill Vernon Philander propelled England to 353 in their first innings.
Advertisement
Roland-Jones, whose hat-trick sealed Middlesex's County Championship triumph last season, struck with just his 10th ball in Test cricket after coming on as first change when Dean Elgar was caught behind to force an early tea.
After the interval, Roland-Jones had Heino Kuhn lbw and South Africa were 23 for two.
Hashim Amla had made 311 not out, South Africa's highest individual score at this level, when the Proteas last played a Test at The Oval in 2012.
Five years on, however, it was a different story as Amla exited for just six, when he could do nothing other than glove a lifting Roland-Jones ball to wicket-keeper Jonny Bairstow.
And when Quinton de Kock, aiming legside, was caught at gully by Stokes, South Africa were 47 for four with Roland-Jones having taken four for 15 in 24 balls at that stage
James Anderson, England's all-time leading wicket-taker, then had South Africa captain Faf du Plessis lbw for one playing no shot.
And the Proteas were 51 for six when Anderson, who turns 35 on Sunday, gave himself another early birthday present when he caught and bowled Chris Morris.
One meagre consolation for South Africa came when, even with the floodlights switched on, the skies above The Oval were so dark that the only to avoid play being halted for bad light was for England to bowl spin at both ends via captain Joe Root and Moeen Ali.
Temba Bavuma (34 not out) and Kagiso Rabada (30) put on 53 to take South Africa past their lowest post-isolation Test total of 79 against India at Nagpur in 2015.
The clouds lifted to allow the quicks back, with Rabada bowled by what was effectively a fast leg-break from Stuart Broad to end a gutsy stay of almost an hour.
Earlier, Philander only bowled five overs on Friday before going to hospital for tests on what was thought to be a stomach complaint.
It was a huge loss for the Proteas, with the in-form seamer having taken two for 17 in 12 overs on Thursday.
England had been criticised by several former captains for some slap-dash batting in a huge 340-run second Test defeat at Trent Bridge that saw the Proteas level this four- match series at 1-1.
But Stokes got the balance right on Friday.
England resumed on 171 for four, with opener Cook 82 not out and Stokes unbeaten on 21.
Former captain Cook fell for 88 when lbw to fast bowler Morne Morkel after his typically painstaking near five-hour innings laid the platform for England's subsequent run-spree.
Fellow left-handed batsman Stokes, who made a Test-best 258 against South Africa at Cape Town last year, cashed in against the old ball and saw off the new.
He was, however, still nine runs shy of his fifth Test hundred when No.11 Anderson came in.
But the 26-year-old went to three figures via two sixes off consecutive balls from left-arm spinner Keshav Maharaj.
The first, a slog to long-on, was 'caught' by du Plessis but he touched the boundary rope, meaning Stokes had a six.
There was no doubt when the subsequent ball sailed into the stands as Stokes completed a 144-ball century and he hoisted Maharaj's next delivery over deep square for another six.
Stokes eventually holed out off Morkel but the damage had been done.
Advertisement