South Africa have kept themselves in the second Test against England after Ben Stokes scored a historic double-hundred on day two to put the tourists in pole position at Newlands.
Hashim Amla finished the day unbeaten on 64 as South Africa reached 141-2 chasing England's declared score of 629-6.
Stokes reached both his hundred and double-hundred in the morning session on day two as England racked up a whopping 196 runs before lunch.
By reaching 200 in 163 balls, Stokes went second in the list of all-time quickest double-hundreds, 10 balls slower than New Zealand's Nathan Astle in 2002.
The all-rounder was eventually out for 258 - a knock that included 30 fours and 11 sixes in just 198 balls - in bizarre fashion as he skied one to AB de Villiers at mid-wicket. It looked an easy catch for the fielder, but De Villiers let it through his grasp before quickly picking the ball up and running Stokes out, with the Englishman thinking that he would be caught and not quick enough to get back to the crease.
As Stokes dazzled with an array of boundaries, Jonny Bairstow kept the strike ticking over at the other end before he scored his maiden Test hundred and celebrated emotionally under the sun in Cape Town.
Stokes and Bairstow's partnership ended at 399 - the highest sixth-wicket stand in Test history - and was the fastest 300 partnership in Tests, beating the record of India's Virender Sehwag and Rahul Dravid from 2006.
Bairstow went on to reach 150 before England captain Alastair Cook declared so that he could have a bowl at the South Africans.
There was an early breakthrough and it came in calamitous circumstances for the Proteas as Stiaan van Zyl was run out by Nick Compton for just four after some confusion with Dean Elgar.
Stokes then added to his magnificent batting display with a wicket by removing Elgar for 44.
Amla (64*) and De Villiers (25*) steadied the ship in the closing stages of the day's play with a third-wicket stand of 56, leaving the hosts 488 runs behind England with eight wickets remaining.