A farewell century by Jacques Kallis and a thumping half-century by tailender Robin Peterson has given South Africa a 166-run first-innings lead over India on the fourth day of the second test on Sunday.
After a teary Kallis signed off in Test cricket with 115, Peterson hit nine fours and a switch-hit for six in his lively 61 off 52 balls and South Africa was 500 all out early in the day's final session at Kingsmead.
Peterson shared a stroke-filled 110-run stand with Faf du Plessis (43) as South Africa scored quickly in an attempt to give itself a chance of a victory with just over a day left in veteran allrounder Kallis' 166th and final test.
Kallis was earlier hugged by most of his teammates following his likely his final innings in Test cricket, when he batted for over six hours for his 45th test hundred. He also moved up to third on the list of all-time test run-scorers - by a single run.
"It's strange walking out to bat knowing that there is no tomorrow and it will be your last opportunity to get a 100 for your country," Kallis said.
South Africa's most successful batsman went to three figures with a nudge to mid-on and celebrated by removing his helmet and lifting both arms in the air as he faced the team dressing room.
He was out to spinner Ravindra Jadeja, who had a career-best 6-138 in India's flagging bowling attack.
India made 334 in its first innings of the final test.
As Kallis walked off waving his bat to the crowd, members of the South African team came out of the dressing room and down the stairs towards the field to hug him one by one.
Captain Graeme Smith kissed the 38-year-old allrounder on the side of the head and then carried Kallis' bat and gloves into the changing room.
Kallis's century also took him past Rahul Dravid and up to the third-highest run-getter in Tests behind India's Sachin Tendulkar and Australia's Ricky Ponting. He needed exactly 115 in his last Test before retiring to overtake former India batsman Dravid.
Top-ranked South Africa took charge of the series-decider against number two India with Kallis's anchoring innings at the same ground in Durban where he made his debut as a 20-year-old prodigy in 1995.
After South Africa slipped to 113-3 on the third day, he had successive partnerships of 127 with AB de Villiers (74), 58 with JP Duminy and a stand of 86 with nightwatchman Dale Steyn, who made 44.
Peterson then unleashed a flurry of boundaries against the new ball after lunch, and Du Plessis also chipped in with four fours before he was run out for 43 by a direct hit from Rohit Sharma.
Morne Morkel was caught and bowled by Jadeja for a duck to end the South African innings and give the slow left-armer his best return in tests.
Straight after passing Dravid and going to 13,289 career test runs, Kallis had attempted a big heave to the legside off Jadeja and top-edged to wicketkeeper Mahendra Singh Dhoni for the first wicket of the day.
Kallis faced 316 balls and hit 13 fours in an innings that began early on Saturday.
Jadeja continued to be India's main threat and bowled a marathon 58.2 overs in South Africa's first innings for his six wicket haul.
Seamer Zaheer Khan had India's other two wickets on the fourth day when Steyn, trying to clatter an eighth boundary, edged behind to Dhoni three overs after Kallis had gone.
Peterson skied a catch to Murali Vijay at mid-on off Khan to end an entertaining and sometimes fortunate knock and Du Plessis was run out in a mix-up with Vernon Philander as South Africa's innings ended quickly after tea.
Kallis announced on Christmas Day that it would be his final Test, taking many by surprise to end the career of South Africa's most successful batsman ever and one of the game's outstanding allrounders.
He said he would remain available for limited-overs internationals in an attempt at a final swansong at the 2015 World Cup.