Stokes (112) soon lost Alastair Cook (88) after England resumed on 171-4 but shared stands of 75 for the sixth wicket and 37 for the ninth, with Jonny Bairstow and Roland-Jones, to ease them to an above-par 353 all out in awkward conditions.
Then Roland-Jones (4-39) knocked over South Africa’s top four under persistent heavy cloud cover and floodlights as the tourists collapsed to 61-7 before a half-century stand between Kagiso Rabada and Temba Bavuma brought a revival to 126-8 at stumps.
Stokes reached his hundred memorably with the second of three successive sixes off Keshav Maharaj, with only No 11 James Anderson for company by then.
But it was the all-rounder’s previous graft and restraint which were the hallmarks of a hugely valuable innings, constructed atypically for a natural strokemaker, and which provided vindication for Joe Root’s decision to bat first in this third Investec Test as England try to bounce back from last week’s defeat at Trent Bridge in a series level at 1-1, with two to play.
After Stokes shepherded the hosts to a credible position, reaching his century with nine fours and those three sixes off 144 balls in almost four-and-a-half hours, it was Roland-Jones’s turn to take over.
The Middlesex seamer, on as first change, had his maiden Test wicket with the last ball before tea when Dean Elgar got a feint edge behind.
His next delivery, after the 20-minute break, brought a huge lbw appeal and unsuccessful DRS review for lbw against Hashim Amla – and although South Africa’s No 3 avoided a golden duck on his return to the scene of his 2012 national-record 311 not out, he was soon to glove Roland-Jones behind for just six.
Before then, the new boy had already done for Heino Kuhn too – lbw missing an attempted on-drive – and Quinton de Kock was then caught at gully off a leading edge to give Roland-Jones his fourth wicket for 15 runs in 24 balls.
Anderson immediately did for Faf du Plessis, lbw shouldering arms and his recourse to DRS futile, and both he and Stokes appropriately got in on the act before the return of the previously wicketless Broad accounted for Rabada with an excellent delivery which trimmed the off bail.
South Africa, minus key seamer Vernon Philander after just five early overs because of a mystery stomach upset which has resulted in hospital checks, had bowled well at times but also inconsistently.
Cook was able to add only six to his overnight score before falling to the 200th delivery he faced.
He was dismissed by Morne Morkel (3-70), for the 10th time in his career, lbw from round the wicket after the opener went to DRS only to discover the umpire’s initial decision was marginally confirmed.
With Philander out of the reckoning, however, Stokes and Bairstow sensed an opportunity to attack Chris Morris and Maharaj.
The former over-pitched as both batsmen took advantage, and Bairstow swept two fours and straight-drove another in the slow left-armer’s first over.
It was not until South Africa took the second new ball that there was instantly a resurgent threat, and it proved too much for Bairstow as Rabada (3-85) found extra bounce to have him edging to second slip.
Stokes had to be much more watchful too, and when new batsman Moeen Ali edged an involuntary four off Rabada just before lunch it was the first boundary in 10 overs.
Stokes’s wait between his seventh and eighth fours extended into mid-afternoon, and 58 balls.
But after Moeen had gone in mildly controversial circumstances, caught-behind off Morkel according to the third umpire on DRS, Roland-Jones and Stokes took England past 300.
Morris was again targeted in one over especially which cost 17 – including the first six of the innings, hooked fine by the No 9.
His fun ended when he first faced Maharaj, lbw pushing forward in defence and missing an arm ball.
England’s last two wickets lasted long enough, though, for Stokes to complete a richly-deserved hundred.
The first of his sixes off Maharaj was carried over at deep midwicket when Du Plessis took the catch but brushed his shoulder on the boundary marker as he fell backwards – and soon afterwards Stokes was last out, caught at long-off when he tried to take on the returning Morkel too.
“It’s probably one of those (hundreds) I’ve worked for the hardest,” said Stokes afterwards.
“I didn’t feel in the best of form on the first day, played and missed at quite a lot of balls – and Vernon had a couple over me.
“I just had to stick in there with Cookie. We knew we just had to work through the hard times, and put away any bad balls.
“Then with ‘Bluey’ (Jonny Bairstow), I think we just fed off each other and put on a good little partnership in not very much time.
As for the moment he reached his hundred alongside Anderson, he just decided he had to go after spinner Maharaj.
“Jimmy said ‘What are you going to do?’ – and I think I just said ‘Wallop’.
“You’re nine down, there’s obviously going to be a seamer coming on the other end and the wind was blowing in my favour so I thought it was the best opportunity to try to get as many runs as we could. Thanks to Faf – he took a good catch, but just managed to fly over. I was just in that frame of mind.