Virender Sehwag and Sachin Tendulkar hit their second successive centuries before South Africa staged a late fightback on day two of the second and final Test, at the Eden Gardens in Kolkata, on Monday.
At close, India were 342 for five in 76 overs, a lead of 46 runs, after South Africa were bowled out for 296 in their first innings in the morning.
Sehwag benefitted from two lifelines to score 165 from 174 deliveries, inclusive of 23 boundaries and two sixes, before falling to part-timer J P Duminy. He was involved in a huge partnership of 249 runs off 348 deliveries for the third wicket with Tendulkar, who scored his fourth century on the trot.
Tendulkar continued his good run with the bat, scoring 106 from 206 deliveries, inclusive of 12 boundaries, before he was caught at first slip off Paul Harris.
South Africa staged a late comeback, claiming three wickets for five runs, including those of Tendulkar, Sehwag and S Badrinath, to regain a bit of the initiative the hosts had.
Earlier, resuming on 266 for nine, South Africa's last pair added 30 runs before Zaheer Khan trapped Wayne Parnell leg before wicket for 12 to finish off the tourists' first innings.
Zaheer played a crucial role in India's comeback, claiming four for 90 in 22 overs, while Harbhajan Singh claimed three for 64.
Hashim Amla (114) and Alviro Petersen (100) had scored centuries on Day 1 to set up a solid foundation before the middle order failed to come to the party. South Africa had lost their way completely after the tea break, losing seven wickets for 38 runs in 25 overs in the post-tea session.
Morning session: (127 runs, 22 overs, 3 wickets)
After the spinners started off, India took the new ball in the 84th over, introducing pace from both ends.
Morne Morkel, who started with a neatly-timed boundary down the ground off Harbhajan in the first over of the day, hit Ishant Sharma through midwicket for his second boundary in the 84th over.
Wayne Parnell then hit Zaheer for two boundaries through the leg side much to the frustration of the Indians. However, Zaheer did not take long to strike; he trapped Parnell leg before wicket for 12 and South Africa were dismissed for 296 in 85 overs in their first innings.
The visitors lasted just 15 minutes on the second day, adding 30 runs in four overs. After dominating the first two sessions on day one, when they were well-placed at 218 for one, South Africa lost their way completely. They lost their last nine wickets for the addition of just 78 runs, and except for the centuries from Hashim Amla (114) and Alviro Petersen (100) no other batsmen crossed even 12.
Zaheer finished as the top bowler for India, claiming four for 90 in 22 overs, while Harbhajan claimed three for 64 in 24 overs.
Gautam Gambhir got the first boundary of the innings, opening the face of the bat and guiding a wide delivery from Morkel through the covers in the second over. In the next, Virender Sehwag then brought Dale Steyn back to earth as he slammed three boundaries in a row off the pacer to take India to 22 after three overs.
South Africa were feeling the heat, with Sehwag taking the attack to the bowlers. Morkel was thumped three times through the off-side for boundaries in his third over as Sehwag raced to 29 from 15 deliveries, having hit six boundaries, to take the total to 45 for no loss after six overs.
Gambhir, after his twin failures in Nagpur, looked keen to make an impact in this match. Not in the best batting form, he showed great purpose by rotating the strike at regular intervals and letting Sehwag continue with his attacking approach from the other end.
Morkel was taken off after his first three overs, during which he gave away 28 runs and was hit for four boundaries. New bowler Wayne Parnell too suffered in his first over, Sehwag hitting him for a boundary through point and then upper cutting a short delivery over the third man boundary for the first six of the innings, to take the score to 60 after just eight overs.
Steyn tried to infuriate Gambhir by having a go at him every few deliveries, but the pacer's frustration only grew when the left-hander hit him for a couple of boundaries in the ninth over.
Against the run of play, India lost the wicket of Gambhir, who was run-out for 25. The left-hander, who hit three boundaries in his 38-ball knock, was sent back by Sehwag as he looked for a second run but it proved to be late as wicketkeeper AB de Villiers whipped off the bails. Not surprisingly, Sehwag was quite angry at having played a role in Gambhir's dismissal after the two openers had dominated with a 72-run stand in 60 deliveries for the opening wicket. (72-1, 9.1)
Murali Vijay got a rude wake-up call when he was struck on the grill of the helmet by a quick bouncer from Morkel in the 11th over. The right-hander kept having problems against Morkel, who troubled him time and again with his steep bounce. Morkel then ended his misery when he got Vijay (7) to edge behind a full outgoing delivery which was nicely taken by wicketkeeper AB de Villiers, diving to his right. (82-2, 12.4)
Morkel was in the middle of a good probing spell and should have been rewarded with another wicket. Sehwag, on 47, tried to defend a short of length delivery that bounced a bit more than expected and edged it behind, but JP Duminy dropped a simple catch at first slip in the 15th over.
Morkel even troubled Sachin Tendulkar with his steep bouncing deliveries and hit him once in his rib cage area. But India avoided further casualties as they went into lunch at 97 for two in 18 overs, trailing South Africa's first innings score by 199 runs.
Sehwag was unbeaten on an entertaining innings of 52 from 45 deliveries, inclusive of hit eight boundaries and a six, while Tendulkar was not out on nine from 14 deliveries.
The South African pacers were stunned by Sehwag's aggression at the start as they were hit for a lot of boundaries with the new ball. Gambhir's run-out saw them pull back things slightly, while Vijay came undone against good attacking fast bowling.
Post-lunch session: (135 runs, 27 overs)
Sehwag got going after the break, clipping Kallis between the square leg and fine leg fielder for the first boundary of the session to take India past 100 in the 20th over.
The India opener continued his assault on Steyn as he slammed another couple of boundaries in his first over after the break.
Even Tendulkar started growing in confidence with every passing over, which he proved by guiding a wide delivery from Steyn through third man for a boundary as India moved to 125 for two after 25 overs.
It did not take long for Sehwag to go after left-arm spinner Harris, whom he slog swept for a huge six over square leg in his second over. In his next over, Sehwag charged down the wicket and lofted one over the mid-on fielder for a boundary to race to 81 from 70 deliveries.
Once he found his rhythm, Tendulkar cut loose as he flicked Morkel for back-to-back boundaries through square leg. In the next over, he swept Harris fine on the leg side for yet another boundary, his sixth of the innings, to move to 38.
In his next over it was Sehwag who slammed him for back-to-back boundaries, through the point region to move to 90 and take India to 165 for two after 31 overs.
The first hour in the second session had gone India's way, as they scored 74 runs in 16 overs, with both Tendulkar (43 from 68) and Sehwag (90 from 75) looking quite comfortable and intent on playing a big innings.
Surprisingly, South Africa kept persisting with the struggling Morkel, and Sehwag made the most of it. He slammed another full delivery through the cover region for his 15th boundary, which took him to 95, five short of his second century in a row.
Sehwag completed his century in style when he cracked a wide delivery from Parnell through point for a boundary. It took the right-hander just 87 deliveries to reach the landmark; he hit 16 boundaries and two sixes, which meant 76 runs in his hundred had come in boundaries.
That boundary also brought the 100-run partnership off132 balls for the third wicket between Tendulkar and Sehwag.
In Parnell's next over, Tendulkar completed his half-century, his 55th in Tests, off 79 deliveries as India reached 195 for two after 37 overs.
Harris decided to switch to over the wicket in a bid to contain the batsmen. But it hardly mattered to Sehwag as he played the reverse sweep for a boundary through point, in the 38th over. He repeated the shot again in the next over, but this time he played the paddle reverse sweep that went fine through the third man region for a boundary.
With the pitch just in its second day, there were no rough patches for Harris to exploit and every time he pitched it wide off the leg stump it was given a wide.
Unlike the first Test in Nagpur, India never allowed Harris to settle down into a good rhythm and looked to score boundaries off him at regular intervals.
At tea on, India were 232 for two in 45 overs, trailing South Africa's first innings score by 64 runs.
Sehwag was unbeaten on a cracking innings of 125 from 115 deliveries, laced with 19 boundaries and two sixes, while Tendulkar was not out on 65 from 106 deliveries, inclusive of nine boundaries.
It was a session that totally belonged to the Indian team, no South African bowler being able to make an impression. Except for Jacques Kallis, who bowled four overs for just 11 runs, all the other bowlers struggled to keep the run-rate down, going for over five runs per over.
Post-tea session: (110 runs, 31 overs, 3 wickets)
Harris should have got the wicket of Sehwag in his second over after the tea break, but AB de Villiers fluffed an easy opportunity. Sehwag, on 129, charged down the wicket to the spinner in a bid to hit another maximum but missed the ball and replacement wicketkeeper de Villiers failed to gather the ball and complete the stumping, in the 48th over.
The Indian batsmen decided to play with caution after the tea break, fully aware that a wicket at this stage could result in a few more. With the two batsmen intent on defence, just 36 runs, including one boundary, came from ten overs after the break as India reached 268 for two after 55 overs.
It took Sehwag nearly an hour after the tea break to get his first boundary, helped by a misfielding from Amla in the covers off Morkel in the 59th over.
The Delhi opener went past 150 off 160 deliveries (21 boundaries, 2 sixes) with a single on the leg side off Kallis in the 62nd over. He slowed down considerably after the tea break, his last fifty taking 73 deliveries, but India were still scoring at more than four runs per over, as they put up 295 for two after 62 overs.
In the next over, India took the lead when Tendulkar clipped Parnell for two runs on the leg side, which also took him into the 90s.
After a quiet first hour in the final session, Sehwag looked to accelerate the scoring rate once again and slashed boundaries in successive overs through the third man region.
Tendulkar completed his century, his 47th in Tests and fourth in a row, with a boundary through square leg off Parnell in the 69th over. The master batsman took 194 deliveries to reach the landmark, having hit 12 boundaries, to put India in control as they dominated the second day with the bat.
It was part-timer Duminy, who provided the breakthrough for South Africa in his very first over; he claimed the wicket of Sehwag, caught at cover for 165. The opener had shred the South African attack to pieces, slamming 23 boundaries and two sixes in his 174 ball-knock, during which he added 249 runs in 348 balls for the third wicket with Tendulkar. (331-3, 70.2)
One wicket followed another, as Tendulkar fell in the very next over. Harris finally came round the wicket and got Tendulkar to drive one, which he edged behind and was taken by Kallis at first slip after a wonderful innings of 106, inclusive of 12 boundaries in his 206-ball knock. (335-4, 71.5)
Subrmaniam Badrinath disappointed once again as he became Dale Steyn's first victim of the innings. The right-hander was beaten by Steyn's pace coupled with the sharp incoming movement that sneaked between his bat and pad to bowl him for 1. (336-5, 75)
Once again the final session proved to be crucial. South Africa checked India's progress, taking three wickets for five runs in the space of five overs.
VVS Laxman survived a few nervy moments towards the end to finish unbeaten on nine, while nightwatchman Amit Mishra was not out on 1.
The batsman took the offer of light as India finished the second day on 342 for five in 76 overs, a slender lead of 46 runs.
India must be disappointed at having lost those three quick wickets towards the end, undoing most of the good work of the first two days. They will be hoping that VVS Laxman can play a sizeable innings on day three and take the team towards a good first innings total.