CAPE TOWN (Reuters) - Jacques Kallis defied medical advice to score a magnificent century which put South Africa in position to win the deciding third test against India on Wednesday. India dominated the morning session and were on course for their first series victory in South Africa when the hosts stumbled to 121 for five at lunch. But Kallis , suffering from a side strain caused by a ball from Shanthakumaran Sreesanth during his first-innings century, dug in and supported by Mark Boucher and Dale Steyn he lifted his side to 341 all out at the close. The experienced all-rounder was expected to be sidelined for two weeks by the injury but he ignored the obvious pain to reach his 40th test hundred, the second time he has scored a century in each innings of a test. Off-spinner Harbhajan Singh claimed two early wickets and Zaheer Khan bowled AB de Villiers (13) off the bottom edge of the bat before lunch. BATTED STOUTLY Ashwell Prince (22) batted stoutly but was well-held low down at point by Sreesanth after a firmly-struck cut shot off Ishant Sharma. But Kallis found a partner he could rely on in Boucher and their 103-run stand for the seventh-wicket was the key factor in South Africa ending the day as favourites after they had been heading for defeat. Boucher scored a typically bullish 55, shrugging off the pressure of playing for his place and the parlous situation when he came to the crease. Boucher fell to a ball that kept low from part-time spinner Sachin Tendulkar before Steyn continued the fightback with a bright 32. The highlight of the day came 45 minutes before stumps when Kallis turned Harbhajan to leg for a single to complete his century after five-and-a-half hours at the crase. Kallis made 161 in the first innings after coming to the crease at 34 for two. With the field spread, tailender Morne Morkel enjoyed himself by scoring 28 and Lonwabo Tsotsobe struck successive boundaries before being caught on the fence. Kallis 's unbeaten 109 was a top-class effort spanning 380 minutes and 240 balls and he almost single-handedly gave South Africa a lead which India's batsmen will be hard-pressed to overcome on a typical final-day pitch. The holder of the national run-scoring record has now scored 40 test centuries, moving past Ricky Ponting into second place on the all-time list behind Tendulkar's 51 hundreds. Kallis 's tally of 11,947 runs is just six runs behind West Indian Brian Lara on the all-time run-scorer's list. "I have not seen many batsmen who could handle conditions like that," Harbhajan, who completed figures of seven for 120, told a news conference. The world's number one side will have 90 overs in which to score 340 runs for victory. Scorecard South Africa first innings 362 India first innings: 364 South Africa, second innings (overnight 52-2): G. Smith lbw b Harbhajan 29 Petersen lbw b Harbhajan 22 Harris lbw b Harbhajan 0 Amla b Harbhajan 2 Kallis not out 109 AB. de Villiers b Zaheer 13 Prince c Sreesanth b Ishant 22 Boucher lbw b Tendulkar 55 Steyn c sub b Harbhajan 32 Morkel c Sreesanth b Harbhajan 28 Tsotsobe c Sehwag b Harbhajan 8 EXTRAS: (lb-7, nb-12, w-2) 21 TOTAL: (all out, 102 overs) 341 FOW: 1-50, 2-52, 3-53, 4-64, 5-98, 6-130, 7-233, 8-287, 9-333, 10-341 BOWLING: Zaheer 20-2-64-1, Sreesanth 24-3-79-0 , Ishant 18-1-62-1, Harbhajan 38-1-120-7, Tendulkar 2-0-9-1