Foakes was still there when England declared on 415-9, with a first-innings advantage of 264 runs.
South Africa openers Dean Elgar (11) and Sarel Erwee (12) negotiated nine overs before stumps to close on 23 without loss. The Proteas were rolled over for 151 on day one after opting to bat in Manchester.
South Africa leads the three-match series 1-0 after an innings win at Lord’s last week.
Stokes marked the release date of the new documentary about his turbulent career with a timely piece of marketing, hitting his 12th Test century, while wicketkeeper Foakes made his second hundred after one on debut in Sri Lanka in 2018.
For much of his first summer in charge, Stokes has been more concerned with making a statement at the crease than a score, driving his team’s ultra-aggressive agenda but selling his wicket cheaply at times.
He struck a more mature balance here, clearing the ropes on three occasions and adding six fours, but also showing durability and diligence to score at a strike-rate of 63.19.
Foakes was even more considered, reaching three figures in 206 deliveries. Between them, the pair got their priorities exactly right, cementing England’s position in the match and laying the foundations for tying the series.
South Africa was four runs in front when Stokes and Foakes came together at 147-5, with Anrich Nortje having taken out the overnight duo of Jonny Bairstow (49) and Zak Crawley (38) in a fiery first spell after the English resumed on 111-3.
Bairstow was first to succumb when he nicked a reverse-swinging delivery to the wicketkeeper before Crawley followed in Nortje’s next over.
The opener won generous praise for grinding out 17 in 77 balls on the first evening but was vulnerable from the outset here. He opened his account with an edge through the cordon and was lucky to see a leading edge land safe before he eventually feathered Nortje behind for 38.
Stokes safely negotiated the remainder of Nortje’s opening burst and rewarded himself by slog-sweeping his first ball from spinner Simon Harmer for six.
A dashed single on 16 left him wincing in pain, his troublesome left knee once again causing discomfort, but a visit from the physio put him right and it was not long before he was punching Lungi Ngidi down the ground for four.
Foakes offered solid support, overturning an lbw decision on 28 before clubbing a no-ball for four just before lunch to take England’s runs for the session past 100.
Nortje was surprisingly held back at the restart in favor of spin at both ends, a decision which played to Foakes’ strengths against slow bowling and allowed Stokes to assert himself again. He reached fifty by smashing Harmer for six on the charge and never looked back. Nortje returned for two further spells but could not recreate his previous menace.
Aiden Markram made a game attempt to pull off a wonder catch when Stokes hammered one in his direction just before tea and the captain reached the break two short of his ton.
Stokes fell six balls after celebrating his century with a familiar gesture in honor of his late father, Ged, whose final days are touchingly captured in the new film. Foakes held up his end to finish unbeaten.
(This story has not been edited by Devdiscourse staff and is auto-generated from a syndicated feed.)