Stokes declared at 415 for nine, with South Africa trailing by 241 runs at the close after surviving a tricky nine over spell before stumps.
The tourists, who lead the three-match series 1-0, reached 23 without loss in their second innings with Sarel Erwee on 12 and Dean Elgar on 11 but they now face a real battle against England’s attack on Saturday.
For all the talk of the ultra-aggressive ‘Bazball’ style introduced under Stokes’ captaincy and the leadership of coach Brendon McCullum, this was an orthodox and disciplined performance as the England captain and wicketkeeper-batsman Foakes put on a 173-run partnership for the sixth wicket.
It was a much needed contribution after South African quick Anrich Nortje struck twice to remove England’s overnight batsmen during an outstanding opening spell in the morning session.
Special innings. Special player. Standing up when we needed him most 👏Day Two highlights:… https://t.co/HBpAqC20k8
— England Cricket (@englandcricket) 1661543100000
Jonny Bairstow fell one run short of his half century, with Nortje adding reverse swing to his top pace and the Yorkshireman edging to Erwee at first slip.
Another fine delivery ended the solid contribution of 38 from under-scrutiny England opening batsman Zak Crawley, with Nortje’s perfect line inducing an edge to keeper Kyle Verreynne.
That meant England were on 147-5, still four runs behind South Africa’s first innings total. But Stokes and Foakes then knuckled down before lunch to begin building the lead.
Stokes showed his intent by hitting spinner Simon Harmer over mid-wicket for six, while Keshav Maharaj had an lbw decision against Foakes go in his favour only for it to be overturned on review.
Two brilliant centuries to help us to a strong first innings total 🙌 🏴 #ENGvSA 🇿🇦 https://t.co/nV4vmymjOS
— England Cricket (@englandcricket) 1661537705000
After lunch Stokes brought up his half-century by hitting Harmer over mid-on onto the England dressing room balcony but he kept his aggression in check for most of his innings.
South Africa were unable to get a wicket during the entire afternoon session as the softer ball on the hard Old Trafford surface give little encouragement to their seam attack.
Stokes accelerated to his 12th Test ton, reaching the landmark in 158 balls with the second 50 arriving in 56 balls.
He had batted with a combination of individual and collective responsibility and the only disappointment for the crowd was that he found the leading edge off Kagiso Rabada and was caught by Elgar at cover before he had unleashed an evening blitz.
As compensation, there were cameos from Stuart Broad (21), Ollie Robinson (17) and Jack Leach (11) and Foakes ended on 113 not out after his second career Test century and his first on home soil.
🚫DAY 2 | STUMPSOpeners Dean Elgar (11*) and Sarel Erwee (12*) survived a tricky period of 9 overs to ensure the… https://t.co/yi8KZnOCyO
— Cricket South Africa (@OfficialCSA) 1661534671000
It had been a fine knock — initially playing the inevitable support role to his skipper before taking the lead in the mounting up of England’s tally — and he looked well satisfied as he walked off unbeaten.
Foakes’ first ton had come on his debut against Sri Lanka in Galle in November 2018 and he was delighted to grab his second against a South Africa attack that had ripped England apart in the first Test at Lords.
“It was a bit of relief. I was overjoyed getting a Test hundred. I’ve had a bit of a wait and I realised how hard they are to come by, so I think I celebrated this one a bit more,” he said.
“It’s obviously not easy and they’ve got a fantastic bowling attack so it was tough out there. That partnership has obviously got us into a good place in the game. Hopefully we can do the job tomorrow and the next day,” he said.
The 29-year-old said he was enjoying playing in the new England set-up under Stokes and McCullum.
“They’re so clear in what they want from you, they don’t put you under too much pressure. They just let you go and do it your way and play with freedom. They’re so supportive.”