Left-arm opening bowler Chanaka Welegedera produced a career-best performance to put Sri Lanka in command on the second day of the second Test match against South Africa at Kingsmead on Tuesday.
Welegedera took five for 52 as South Africa were bowled out for 168 on a good batting pitch, giving Sri Lanka a first innings lead of 170.
It also gave Sri Lanka hope of gaining their first Test win of the year, in a complete turnaround from the first Test at Centurion, which South Africa won by an innings and 81 runs.
Sri Lanka were seven for one in their second innings at the close, with captain Tillakaratne Dilshan falling to Dale Steyn before bad light stopped play.
Welegedera, whose previous best Test figures were five for 87 against Pakistan in Sharjah last month, bowled an impeccable line, slanting the ball across the right-handed batsmen, with all of his victims caught behind or in the slips.
Left-arm spinner Rangana Herath took four for 49 as South Africa crashed to their lowest total against Sri Lanka.
The tourists were earlier bowled out for 338. Thilan Samaraweera made a century and Marchant de Lange took seven for 81 on his debut.
De Lange's figures of seven for 81 were the best recorded by any bowler in Test matches in 2011 and put him at the top of an extraordinary crop of eight bowlers who have taken five or more wickets in an innings in their first Test match this year.
Samaraweera made 102 before he was the last man out. He became only the second Sri Lankan to hit a Test century in South Africa, joining Hashan Tillakaratne, who made 104 at Centurion in 2002-03.
Samaraweera and Herath frustrated the South African bowlers at the start of the day, adding 46 to the overnight total of 289 for seven, with Samaraweera batting watchfully to reach his 13th Test century off 265 balls.
After Samaraweera reached his hundred, Herath top-edged a slog against De Lange and was caught by wicket-keeper Mark Boucher for 30.
The tall, strongly built De Lange quickly wrapped up the innings, having Welegedera caught at short leg fending off a vicious bouncer before Samaraweera was caught at deep cover.
South Africa reached 22 for no wicket with Graeme Smith and Jacques Rudolph looking at ease before Rudolph played a loose hook against Thisara Perera and was caught at long leg by a diving Welegedera.
Welegedera then struck twice, having South African captain Smith caught behind for 15 and Jacques Kallis caught at second slip without scoring.
Hashim Amla and AB de Villiers added 76 for the fourth wicket before Welegedera made another double strike soon after tea to plunge their innings into terminal decline, dismissing De Villiers for 25 and Amla for a fluent 54.
Amla hit ten fours in an 83-ball innings.
Herath kept the pressure on the batsmen and it needed some bold hitting from tail-enders Dale Steyn and Imran Tahir to enable South Africa to avoid the follow on.
Only two South Africans have achieved better figures on debut than De Lange - a late replacement for the injured Vernon Philander, who also made an exceptional start to his Test career, with four five-wicket hauls in his first three matches, including five for 15 on his debut against Australia.
Lance Klusener took eight for 64 against India in Kolkata in 1996 while Alf Hal hadl picked up seven for 63 against England at Cape Town in 1923.