Bad light thwarted South Africa's victory charge after Sachin Tendulkar created history by hitting his 50th Test century on day four of the first Test at SuperSport Park, in Centurion, on Sunday.
When rain stopped play, India were 454 for eight in 122.2 overs in their second innings, still needing another 30 runs to avoid an innings defeat.
Tendulkar was unbeaten on 107 from 226 balls, having hit 13 fours and a six, while S Sreesanth was unbeaten on three.
Tendulkar and captain Mahendra Singh Dhoni, who made a quick 90 from 106 balls, launched a spririted fightback, putting on 172 runs for the seventh wicket.
Tendulkar became the only batsman to scale 50 centuries in Test cricket by taking a single through the covers off Dale Steyn in the 115th over. Playing in his 175th Test, the veteran batsman completed his century -- his seventh hundred of the year -- from 197 balls.
Rahul Dravid made 43 from 109 balls and also went past 12,000 runs in Test cricket before Morne Morkel produced the perfect outswinger to have him caught behind.Earlier, Jacques Kallis completed his maiden Test double century and AB de Villiers blasted the fastest ever century by a South African to help the hosts post a mammoth 620 for four in 130.1 overs.
Kallis smashed a career-best 201 not out from 270 balls, having hit 15 boundaries and five sixes. De Villiers blasted 129 from just 112 balls, slamming 12 fours and five sixes, including two in a row to complete his hundred in some style. The two batsmen were nearly unstoppable as they added 224 runs in 226 deliveries for the fourth wicket in an attacking display not regularly witnessed in Test cricket. De Villiers was at his attacking best and made a mockery of the Indian bowling attack to score a century from just 75 balls.
Pacer Morne Morkel claimed five wickets as India were dismissed for a paltry 136 in 38.4 overs in their first innings.
The lanky Morkel used his height to good advantage, extracting a lot of bounce on a lively Centurion pitch to register career-best figures of five for 20 in 12.4 overs.
Morning session: (87 runs, 33.4 overs, 4 wickets)
The first session was always going to be crucial as far as the outcome of the match was concerned. India's batsmen had a good wicket to bat on and continue the good work of their openers, but South Africa thwarted their hopes by taking wickets at regular intervals.
South Africa started with Morne Morkel and Lonwabo Tsotsobe, holding back their premier strike bowler, Dale Steyn.
Dravid and Ishant were able to negotiate the first 30 minutes without problems as the pitch offered no help at all for the pacers. Ishant got the first boundary of the day when he played a wide delivery from Tsotsobe through the cover region but got lucky in the pacer's next over when his edge flew over the slips for another four.
Morkel thought he had the wicket of Ishant when he took a simple return catch off a leading edge but it was ruled a no-ball after consultation with the third umpire.
But he fell soon after when he chipped one on the leg side and Amla completed a sharp catch at short leg to give Steyn his second wicket of the innings. Ishant, sent in as nightwatchman, performed a satisfactory job as he scored 23 in 51 balls, adding 44 runs in 15.2 overs for the third wicket with Dravid.
Tendulkar seemed in good touch and proved that by guiding a wide delivery from Steyn through point for a boundary, and in the next over did the same to Kallis.
David, meanwhile, looked settled and showed exemplary footwork to every delivery he played. Even though he was defending most of the time, when the loose ball was on offer he was quick to pounce on it.
Dravid took a single off Harris to take his score to 43 and also bring up 12,000 runs in Test cricket. He becomes only the third player in the history of Test cricket to breach the 12000-run mark behind Tendulkar and Ricky Ponting.
But he fell on the same score when Morkel produced a splendid delivery that swung just enough to take edge and have him caught behind.
VVS Laxman's trademark timing came to the fore when he hit two delightful boundaries off a single over from Harris.
But Laxman, who has so often rescued India in the past, failed to deliver. He went after a full delivery from Tsotsobe but ended up getting a thick edge and was caught at gully for eight.
At the other end, Tendulkar was unfazed and continued batting positively. He crashed a short wide delivery from Kallis through the covers for a four and in the next over repeated the dose on Tsotsobe for the same result.
Suresh Raina (5) gifted his wicket away with a pretty tame shot when he guided Kallis straight into the hands of the first slip fielder. The youngster, who started with a century on debut, has now made just 64 runs in his last eight innings and would definitely make way for Cheteshwar Pujara in the next match.
Despite the pitch not having much for the bowlers, South Africa's pacers continued to toil and forced the Indian batsmen into making mistakes.
Post-lunch session session: (117 runs, 28.1 overs)
The pitch was still good for batting and India counter-attacked after South Africa took the new ball. Dhoni looked to play shots at every opportunity, while Tendulkar also maintained a good tempo to lead the recovery.
Dhoni started by blasting Tsotsobe for two powerful boundaries through the off-side, in the 79th over, to signal his intentions.
South Africa took the new ball straight after 80 overs but it worked for India rather than the hosts as runs started to flow with the batsman stroking boundaries at will.
Even Morkel came under the hammer. Tendulkar cut him for a boundary through point, while Dhoni pulled him back-to-back boundaries, through midwicket and cover respectively.
Tendulkar brought up his 60th Test fifty off 94 balls in some style when he slapped a full delivery from Steyn through the covers. In the same over, Dhoni drove Steyn down the ground for yet another cracking boundary.
India's captain was in full flow as he slammed Kallis for three consecutive boundaries in the next over to race to 47 from 38 balls. Dhoni got to his fifty from just 40 balls, having hit nine fours, with a single on the off-side in the 89th over.
South Africa brought on Harris to vary the pace and stop the flow of runs. And the move nearly paid off but the left-arm spinner had a very close shout for leg before wicket against Tendulkar turned down, in the 92nd over.
The hosts resorted to a defensive field looking to stifle the flow of runs and force the two batsmen into making mistakes. Dhoni still managed to find the boundary when he clipped the full delivery from Morkel through midwicket as India reached 360 for six after 95 overs.
Tendulkar shut shop hoping to end the session without any damage, but Dhoni was quick to despatch the loose deliveries. Tsotsobe erred in length and Dhoni needed no second invitation as he thrashed a full delivery through the covers to overtake Tendulkar and move to 67.
Steyn came on just before the tea break with South Africa hoping to end the session on a high, but Tendulkar cut him past point for a boundary, his first after nearly 17 overs.
At tea on the fourth day, India had recovered to 394 for six in 106 overs, reducing the deficit to 90 runs.
Tendulkar looked good for this 50th Test century as he reached 80 from 161 balls, having hit 10 fours. Dhoni slowed down a bit towards the end of the session but still scored at a good rate for 72 from 83 balls, with the help of 12 fours.
Steyn, Morkel and Tsotsobe were made to work hard for their wickets as the pitch started to ease out. But they would be aware that one wicket would expose the tail and change things dramatically.
Post-tea session: (60 runs, 16.2 overs, 2 wickets)
While everyone was interested to see how the match would span after the tea break, the bigger interest was definitely to see if Tendulkar would get to 50 Test centuries.
Tendulkar hit Morkel for a four each in successive overs at the start of the session to take India past the 400-run mark and also get closer to his century.
Dhoni also helped himself to a boundary when Harris dropped one short and was promptly despatched to the point boundary.
Tendulkar was keen to get to his century as soon as possible. He danced down the wicket to Harris and lofted him down the ground for a huge six and got to 95.
The 37-year-old got to his 50th Test century when he played Steyn through the covers for a single. It took him 196 balls to reach the landmark and he celebrated by raising his arms in triumph as he crossed over before looking up as he always does to thank his late father.
Tendulkar has now scored seven centuries, including two double tons, in 13 Tests this year for a tally of more than 1500 runs and counting.
The very next ball, Dhoni joined in the celebrations as he slammed Steyn through the covers for a cracking boundary.
It seemed that Tendulkar's nervousness was over after getting his hundred. He moved confidently to the front foot before driving a full delivery from Harris through the off-side for a boundary.
Steyn dealt a vital blow when he got the vital wicket of Dhoni. India's captain, who had slammed 90 from 106 balls (14 fours), tried to fend away a short delivery but only managed to edge it behind.
Dhoni had played a huge role in launching India's fightback along with Tendulkar as the duo put on 172 runs for the seventh wicket.
In the very next over, South Africa took another huge stride towards victory. Harris got Harbhajan (1) caught at first slip as the right-hander tried to play the drive through the off-side but was beaten by the turn.
It was only a couple of overs before it got very dark at the stadium, coupled with a bit of rain forcing play to end early.
At stumps, India were 454 for eight in 122.2 overs in their second innings, still needing another 30 runs to avoid an innings defeat.
Tendulkar batted most of the day to score 107 from 226 balls, hitting 13 fours and a six, while S Sreesanth was unbeaten on three.
After suffering for two days and half, India finally showed their fighting spirit with a convincing batting display.
Tendulkar again showed that despite his age he continues to dominate bowlers worldwide. The South African bowlers found it impossible to breach his defences as he scored at a good rate to lead India's fightback.
Steyn was the pick of the bowlers as he chipped in with wickets whenever called upon to bowl for wonderful figures of three for 103 in 27.2 overs. Morkel failed to repeat his heroics of the first innings as he took one for 91, while Harris contributed two for 88 and Tsotsobe bagged one for 98.