Mayank Agarwal's double-century helped India build up a huge lead before spinners Ravichandran Ashwin and Ravindra Jadeja tightened their grip on the first Test against South Africa.

Batting in only his eighth Test innings - and his first in India - Agarwal (215) became the 23rd Indian batsman to post a double century in the longest format, having shared a 317-run opening stand with Rohit Sharma (176).

Virat Kohli eventually called his men in when they were 502-7 in the day's final session, and Ashwin and Jadeja took three wickets between them in the 20 overs South Africa's batsmen faced to leave them firmly up against it.

Aiden Markram, Theunis de Bruyn and Dane Piedt all fell as the Proteas closed on 39-3, still 463 runs adrift.

Rohit resumed on 115 and Agarwal, 84 overnight, soon joined him in reaching three figures - the openers then going on to become only the third Indian pair to have a first-wicket partnership worth 300.

South Africa finally made a breakthrough when Rohit, one shy of his best Test score, was stumped off Keshav Maharaj (3-189) in his first innings as an opener.

Cheteshwar Pujara fell from the first ball after lunch and captain Kohli (20) meekly chipped back to bowler Senuran Muthusamy to give him his first Test dismissal before Agarwal reached his double century off 358 balls.

After Ajinkya Rahane became the fourth man out, Agarwal's knock was finally ended when Piedt took a diving catch at deep midwicket from Dean Elgar's only over, with Kohli declaring after Jadeja (30 not out) helped take India past 500.

South Africa then lost Markram at the start of their eighth over, a delivery from Ashwin (2-9) that snuck between bat and pad, and the same bowler found De Bruyn's edge to leave the Proteas two down.

Nightwatchman Piedt was bowled by Jadeja (1-21) six balls later, meaning Elgar (27 not out) and Temba Bavuma (7no) will start day three needing to drag their team out of the mire.