Joe Root hit a thrilling century for England as he and Ben Stokes transformed the third Test against South Africa at the Wanderers Stadium on Friday.
England were 238 for five when the threat of lightning brought an early close on the second day, 75 runs behind South Africa's first innings total of 313.
Root was on 106 not out, his ninth Test century.
A fifth-wicket partnership of 111 in 78 minutes off 97 balls with Stokes (58) swung the match dramatically in England's favour after a four-pronged South African pace attack had reduced the tourists to 91 for four.
Root and Stokes counter-attacked, posting a fifty partnership off only 35 balls in a match where the average scoring rate had hovered at around three an over on a pitch offering help to the fast bowlers.
"He takes the pressure off you," Root said of the left-handed Stokes. "He comes in and plays aggressively, the slips come out and there are men on the boundary. You can run well between wickets because there all those gaps. Hopefully he can continue in the form he is in for the rest of the trip."
Root reached the first half-century of the match off 77 balls with nine fours. He admitted that he struggled in the early stages of his innings against some high-quality pace bowling. "I was all over the place, my feet were going nowhere and I was just happy to get through to lunch."
But the advent of Stokes brought a change in his own game. "When you see someone scoring at the other end like that and putting your opponents under pressure it brings that out in your own game."
Stokes, who hit a dazzling 258 in the drawn second Test in Cape Town, got a hostile welcome from Morne Morkel, fending a bouncer off his glove for a single.
But in the next over Stokes pulled a short ball from Rabada for six. He reached his fifty off 46 balls and his innings lasted 54 deliveries before he offered a caught and bowled chance to Morkel off a leading edge.
Root continued to bat aggressively and reached his century off 126 balls when he punched Chris Morris through the covers for his 16th four.
"Tomorrow (Saturday) it’s about making it a big one, building a partnership with Jonny (Bairstow), trying to get some kind of lead," said Root, who needed treatment for a cramping left calf towards the close before reassuring it was nothing serious.
England got off to a bad start when Kagiso Rabada had Alex Hales caught at second slip for one. It got worse when Hardus Viljoen took a wicket with his first ball in Test cricket, having England captain Alastair Cook caught down the leg side by wicketkeeper Dane Vilas for 18.
Nick Compton survived a chance to AB de Villiers at second slip on six and went on to add 52 for the third wicket with Root before edging Rabada to Dean Elgar at second slip for 26.
James Taylor was caught at short leg off Morkel for seven.
Rabada, 20, was the best of a quartet of bowlers, all of whom exceeded 140kmh. Rabada had an outstanding first spell with the new ball of one for seven off six overs. He finished the day with two for 44.
Stuart Broad, James Anderson and Stokes took a wicket apiece as South Africa added 46 runs to their overnight total of 267 for seven.
Wicketkeeper Jonny Bairstow took six catches and missed a chance to equal the world record of seven when he dropped last batsman Morkel.
All of the South African batsmen reached double figures - the 13th instance in Tests. It was the lowest total in which it had been achieved.
Anderson was ordered out of the bowling attack for running on the prohibited area of the pitch after two official warnings. Stokes took over from Anderson and with his first ball of the day had Morkel caught at first slip by Cook.
Stokes finished with the best English figures of three for 53.