That stand ended with the very first ball after tea when recalled seamer Ollie Robinson had Nortje lbw before Rabada was last man out after edging a drive off left-arm spinner Jack Leach to Joe Root at slip.

The true worth of South Africa's total, however, will only become apparent when England bat.

Elgar, with World Test Championship leaders South Africa 1-0 up in a three-match series despite a fallible top order, took a calculated risk in deciding to bat first upon winning Thursday's toss in overcast conditions that favoured fast bowlers.

His thinking was influenced by the recall of off-spinner Simon Harmer in place of left-arm quick Marco Jansen in the only change to the team that overwhelmed England by an innings and 12 runs in the first Test at Lord's last week.

The pitch is expected to offer more turn later in the game.

Dropping the towering Jansen looked harsh particularly as he had both bowled well and made a valuable 48 during a low-scoring match where England, having won all four of their previous Tests, suffered their first defeat under the leadership duo of captain Ben Stokes and coach Brendon McCullum.

None of the top order got near Jansen's score on Thursday, with Keegan Petersen's 21 the highest contribution by a specialist batsman, albeit one equalled by wicketkeeper Kyle Verreynne.

Anderson struck in just the fifth over when he had Sarel Erwee, fresh from a fine 73 at Lord's, well caught by diving wicketkeeper Ben Foakes off an inside edge.

Elgar, Erwee's opening partner, had a couple of reprieves before he fell for 12, with Robinson, in for Matthew Potts in the only change to England's side at Lord's, denied his wicket by a marginal no-ball.

Stuart Broad, coming on as first change, twice beat Elgar before he dismissed him, Jonny Bairstow holding a good low catch at third slip and he then removed Petersen with another catch in the cordon in a return of 3-37 in 11 overs.

Stokes at the double

Stokes (2-17) then got in on the act with just his third ball when Aiden Markram (14) top-edged a pull to Foakes.

The all-rounder struck again when Rassie van der Dussen was lbw for 16, a tight decision upheld on review.

Anderson has done many things during a career that has seen him become the most successful fast bowler in Test history, but a hat-trick has eluded him.

He came close Thursday when he had Harmer and Keshav Maharaj plumb lbw with successive balls only to spear the hat-trick delivery, to Rabada, well down the legside.

The sun came out to make batting easier, but the change in conditions could not fully explain England's curious decision to set increasingly defensive fields to Rabada, yet to score a first-class fifty.

Last man Lungi Ngidi played one of the shots of the innings when he drove Robinson down the ground for four, his lone scoring stroke before Rabada was dismissed.