Allrounder Jacques Kallis scored his second century of the match to put South Africa on top going into the final day of the series-deciding third and final Test against India in Capetown.
Kallis, in pain from a side injury which kept him from fielding, made 109 not out as South Africa recovered from a 130 for six to be all out for 341 off the last ball of the day, leaving India needing 340 to win on a wearing pitch with uneven bounce.
The innings puts Kallis into second place on the all-time list of Test centurions.
It was his 40th hundred, one more than Australia's Ricky Ponting and 11 fewer than India's Sachin Tendulkar.