India effected a dramatic turnaround by taking three wickets for five runs in the last hour to reduce South Africa to 269 for six at stumps on the opening day of the second Test in Centurion.
Off-spinner Ravichandran Ashwin snared three crucial wickets as the visitors fought back after the duo of Hashim Amla (82) and Aiden Markram (94) batted resolutely.
At the end of day's play, captain Faf du Plessis was unbeaten on 24 runs (77 balls, 3 fours) while Keshav Maharaj was batting on 10.
On a day when the Indian pacers failed to make much of a dent on an easy-paced wicket, Aswhin (3/90) emerged as the most successful bowler as he dismissed Markram (94), Dean Elgar (31) and Quinton de Kock (0).
The hosts were going strong with Amla (82) anchoring the Proteas innings after Markram, playing on his home ground, missed out on a well-deserved century by a whisker.
However, two run-outs and a wicket by Ashwin within 13 balls saw South Africa slump from 246/3 to 251/6 as India sought to wrest control of the match while somewhat masking a couple of questionable selections in the playing XI.
Post tea, Amla and AB de Villiers (20) took their third-wicket partnership to 51 runs. South Africa crossed 200 in the 64th over, but not before losing de Villiers as he played on off Ishant Sharma (1-32), who got just reward for his toiling spells.
Amla then put on 47 runs with du Plessis, and in doing so, scored his 36th Test half-century off 99 balls. It looked to be a dominant day for the hosts before a mini-collapse came by.
First, in the 81st over, Amla was run-out against the run of play, getting mixed up with du Plessis as he set off for a single but Hardik Pandya (0-37) found the target on the non-striker's end off his bowling.
Two balls later, Ashwin dismissed Quinton de Kock for a golden duck, caught at slip. Vernon Philander (0) was then run-out on the last ball of the 83rd over as he set off for a run even as du Plessis called no from the non-striker's end.
India took the new ball in the 87th over, but South Africa managed to avoid any further damage.
Earlier, Aiden Markram scored 94 runs as South Africa reached 182/2 at tea. The opener faced 150 balls and hit 15 fours.
Post lunch, Markram and Dean Elgar (31) took their opening stand to 85 runs. Ashwin got the breakthrough for India early in the session, albeit it was a lucky dismissal.
The shot from Elgar hit Murali Vijay in the mid-riff and lodged there, with the fielder acting quickly enough to catch it.
India then attacked Amla with short stuff as also attempting to lure him outside the off-stump. Jasprit Bumrah (0-57) was unimpressive in this spell, unable to find the right line to attack the batsmen.
Mohammed Shami (0-46) was haywire too, and India had to recall Ishant and Ashwin back into the attack. Meanwhile, Amla and Markram added 63 runs for the second wicket.
Markram's wicket came against the run of play. He asked for DRS review and was a tad unlucky as the edge was doubtful. But there wasn't sufficient evidence to overturn the on-field umpire's decision.
South Africa had crossed 100 in the 36th over, and their 150 came up in the 47th. Amla, batting on 30 then, was lucky to survive as Parthiv Patel dropped him off Ishant in the 51st over, the ball going down leg side after the batsman edged it.
In the morning, South Africa had reached 78 for no loss at lunch making first use of an easy day one pitch.
Elgar and Markram had started watchfully against the new-ball pairing of Bumrah and Shami, the latter conceding 23 runs off his four overs.
The new ball bowlers failed to create any chances, and Ishant came on as first-change in the 8th over. He immediately troubled Elgar and continued to do so throughout his first spell.
Pandya came on to bowl in the 13th over. By the 20th over, when Ashwin was introduced into the attack, India had used up all their frontline bowlers in just over an hour's play.
Ashwin too probed Elgar, and in the 24th over, had a caught-behind appeal turned down. India opted for DRS review but there was no edge.
The Proteas had crossed 50 in the 21st over. Meanwhile, Markram reached his second Test half-century off 81 balls, just before the break.
India made three changes to their eleven, with KL Rahul replacing Shikhar Dhawan and Ishant Sharma coming in for Bhuvneshwar Kumar, which attracted widespread criticism from former players.
Wriddhiman Saha was ruled out due to a strain and Parthiv Patel took his place in the team.