Ben Stokes and Ben Foakes produced with the bat as England built a comprehensive 241-run lead over South Africa on day two of the second Test at Old Trafford.

The duo each brought up centuries as England recovered from the early loss of Jonny Bairstow in terrific fashion, reaching 415-9 before Stokes declared with the hosts having built a mammoth first-innings advantage of 264.

While England's bowlers failed to cap a tremendous day in Manchester with a late wicket, South Africa's opening duo were limited to 23 runs, leaving them with a mountain to climb on day three.

After seeing Bairstow bat England out of trouble on Thursday, South Africa began day two looking for quick wickets, and Anrich Nortje (3-82) got them off to a fine start.

Having stopped Bairstow one run short of his half-century, he accounted for Zak Crawley (38) with a superb delivery just two overs later as the hosts began nervously after resuming on 111-3.

But the Proteas failed to make that momentum count as England steadied themselves either side of lunch, with Stokes (103) and Foakes (113 not out) striking up a fearsome sixth-wicket partnership of 173 to drive Brendon McCullum's men into a commanding lead.

Stokes brought up his 12th Test hundred – and first as captain – shortly before being caught by Dean Elgar off Kagiso Rabada's delivery, but Foakes was unaffected as he went on to rack up just his second tonne in the format.

Foakes survived as Stuart Broad (21), Ollie Robinson (17) and Jack Leach (11) were dismissed before Stokes' declaration, with the home side then seeing out the day without incident after taking up the ball.  

Sarel Erwee (12 not out) and Elgar (11 not out) managed just two boundaries between them in a quiet final nine overs, leaving England as favourites to avoid suffering their first back-to-back home Test defeats since August 2008.

England give South Africa the Bens

Stokes' superb knock eased the pressure on England following a less-than-ideal start on Friday and brought him his fourth Test hundred against South Africa, more than he has managed against any other side (three each versus West Indies and Australia, one apiece against India and New Zealand).

The skipper was upstaged, however, as Foakes cruised to his highest score in the format, recording a first home Test century despite failing to hit a single six.