A triple century by Hashim Amla and four strikes by South Africa's bowlers had England reeling on the fourth day of the first cricket test at the Oval.
Amla made 311 not out as South Africa reached 637 for 2 declared to claim a first innings lead of 252.
England were 102 for 4 at the close, needing another 150 runs to avoid an innings defeat.
Amla and Jacques Kallis (182 not out) batted with relentless concentration and skill as they put on an unbeaten 377 for the third wicket, a record for any wicket in matches between England and South Africa.
Amla is the first South African to hit a Test triple century.
The country's previous highest score was 278 not out by AB de Villiers against Pakistan in Abu Dhabi in 2010-11.