AB de Villiers crafted an unbeaten half-century to put South Africa in a promising position on a third day of the second Test which was cut short by bad light after India captain Virat Kohli lit up Centurion with a sublime hundred.
A magnificent 21st Test century from Kohli (153) got the tourists up to 307 all out on Monday, Morne Morkel taking 4-60 as the Proteas earned a first-innings advantage of 28.
An intriguing contest appeared to be swinging India's favour when Jasprit Bumrah reduced South Africa to 3-2, but De Villiers (50 not out) and Dean Elgar (36no) came to the rescue with an unbroken third-wicket stand of 87 on a deteriorating pitch.
South Africa were 90-2 when the players were taken off 10 overs into the final session under dark skies, leading by 118 as they strive to wrap up the series with one match to play.
Kohli carried on where he left off on day two after India resumed on 183-5, the skipper adding the 15 runs he needed to raise his bat yet again, reaching three figures by working debutant Lungi Ngidi into the leg side for two.
Hardik Pandya had shown restraint, but gifted South Africa his wicket when he ambled through for a single but was run out by Vernon Philander, the all-rounder failing to ground his bat or a foot despite being beyond the crease.
Kohli found another able partner in Ravichandran Ashwin (38), who dispatched Kagiso Rabada for three consecutive boundaries as Kohli continued to look untroubled.
Ashwin struck seven boundaries and put on a much-needed 71 with Kohli for the seventh wicket before edging Philander, steaming in with the new ball, to Faf du Plessis at second slip.
Morkel removed Mohammed Shami and Ishant Sharma cheaply, but Kohli was able to bring up 150 by pulling the paceman to the midwicket boundary before the innings was ended when he holed out to the same bowler.
Bumrah (2-30) set the alarm bells ringing for South Africa when he trapped Aiden Markram and Hashim Amla leg before, but De Villiers showed positive intent and Elgar grafted for his runs on a tricky surface, indifferent bounce making life difficult for the batsmen.
De Villiers found the ropes six times and reached his 50 before play ended prematurely due to the failing light, a rain delay having also brought the players off after tea.