England captain Alastair Cook made his first half-century of the series to keep his team in contention on the second day of the fourth and final Test against South Africa at SuperSport Park on Saturday.
England were 138 for two at the close of play after Quinton de Kock's maiden Test century took South Africa to a first innings total of 475.
Cook, who had scored only 103 runs in six innings in the first three Tests, batted solidly to finish unbeaten on 67.
England lost Alex Hales early, when he sliced a drive against Kagiso Rabada to Dane Piedt at point after making 15.
Nick Compton helped Cook add 56 for the second wicket before he fell victim to a ball from Rabada which shot through low and trapped him leg before wicket for 19.
Joe Root joined Cook and the pair took England through to the close in an unbeaten partnership of 60. Root was on 31 not out.
The left-handed De Kock made 129 not out off 128 balls as he and the South African tailenders frustrated the England bowlers on a hot, humid day.
De Kock, 23, has long been considered a prodigy but he admitted he had gone through a low period in his life after he was dropped during a series in Bangladesh last year.
"I wasn't scoring runs. They didn't tell me why I was dropped but I figured it out," he said.
"I was in a bad space and didn't enjoy my cricket for a little bit afterwards."
Consigned to the South Africa A side, he started making runs against India A in India.
He offered an unusual reason for his return to form.
"I didn't really care to be honest, so I was playing with an open mind and playing freely. I started playing with confidence and enjoying my game again."
De Kock said he decided to try to "turn up the heat" on the England bowlers after overnight partner Temba Bavuma and Kagiso Rabada fell early in the day to reduce South Africa to 336 for seven.
Kyle Abbott helped De Kock add 50 for the eighth wicket and Dane Piedt shared a ninth wicket stand of 82 with the South African wicketkeeper.
De Kock was the third centurion in the innings and joined debutant Stephen Cook in making his first Test hundred.
England once again paid the price for dropped catches. After both Cook and Hashim Amla were dropped on the way to centuries on the first day, De Kock was put down by Ben Stokes at gully off James Anderson when he was on 28, having added only three runs to his overnight score.
De Kock was dropped again on 90 when he drove Moeen Ali hard to England captain Alastair Cook at short cover.
Despite the blemishes it was an impressive innings by De Kock, who hit 17 fours and two sixes.
He was particularly severe on Ali, hitting 45 runs off the 28 balls he faced from the off-spinner, including both his sixes and six fours.
England would have hoped to wrap up the innings quickly after taking two wickets early in the day for the addition of only seven runs to the overnight total of 329 for five.
Stuart Broad had Temba Bavuma caught behind for 35 in the fourth over of the day, ending a sixth wicket partnership of 62 with De Kock.
In the next over James Anderson trapped Kagiso Rabada leg before wicket without scoring.
Stokes was England's most successful bowler, taking four for 86.
"We got through a tough patch," said Stokes. "After a long time in the field there were some tired bodies and tired minds so I think we've done well to get through to the end of play with two down."
Stokes admitted dropped catches had been costly.
"In Test cricket, good players make you pay and they certainly have done in this innings," said Stokes.