Aiden Markram hit a thrilling century for South Africa but India moved closer to a series-levelling win on the second morning of the Test at Newlands.
Markram hit 106 off 103 balls before the Proteas were bowled out for 176 shortly before lunch.
They added 94 runs for the loss of seven wickets during the morning.
India, beaten by an innings and 32 runs in the first Test in Centurion, needed 79 runs to square the two-match series.
Jasprit Bumrah took 6-61 – and was denied the wicket of Markram when the batsman, on 71, edged a drive and wicketkeeper KL Rahul could not hold a catch above his head.
Markram defied a pitch which has given inordinate help to the bowlers and on which the highest score of any of his teammates in either innings was 15.
He hit 17 fours and two sixes, one of which, off Prasidh Krishna, sailed out of the ground and onto a railway line beyond square leg.
The 29-year-old was finally out caught at mid-off by Indian captain Rohit Sharma off Mohammed Siraj attempting another big hit.
What a time to bring up your first Newlands century ⭐
That is Markram’s seventh hundred in Test cricket 💯
📱 Stream #SAvIND live: https://t.co/ACEUH7ehZ3#WozaNawe | #BePartOfIt pic.twitter.com/Bgp5EUxkrt
— SuperSport 🏆 (@SuperSportTV) January 4, 2024
© Agence France-Presse
Photo: Ryan Wilkisky/BackpagePix