Kumar Sangakkara smashed his 49th half-century as Sri Lanka launched a stunning fightback on the fourth day of the first Test against South Africa on Saturday. (Scorecard)
The prolific left-hander also shared 96 runs for the unbroken second wicket with Kaushal Silva (37) to take Sri Lanka to 110-1 at stumps.
The hosts need 260 runs with nine wickets in hand to pull off a magical come-from-behind win with three full sessions left in the game.
Sri Lanka had been forced on the backfoot after they were bowled out for 292 to concede a huge 163-run lead in the first innings.
But a sporting declaration by new South African skipper Hashim Amla at the tea score of 206-6 turned the game on its head.
Although no team has ever scored more than 300 runs in the final innings at Galle, the 36-year-old Sangakkara made a target of 370 look chaseable.
The star batsman had so far hit seven fours and a six in his 58-run knock that came off 89 deliveries.
South Africa began their defence well, with Dale Steyn once again giving his side the early breakthrough by dismissing opener Upul Tharanga for 14.
But Sangakkara stood like a rock at the other end, once despatching a full-toss from Tahir over the mid-wicket fence for a huge six.
He completed his half-century in style, sweeping leg-spinner Imran Tahir through midwicket for a four.
Silva also knocked off some easy runs, smacking part-timer Jean-Paul Duminy for two fours in a row.
-- Amla fails with bat again --
Vernon Philander, who was Friday fined 75 percent of his match fees after being accused of ball tampering, bowled six wicketless overs for 13 runs.
Earlier, AB De Villiers hit six boundaries in his breezy 58-ball 51 and also shared 62 runs with Quinton de Kock (36) to set up South African second innings.
The Proteas had made 455-9 declared in their first essay.
To their credit, the Sri Lankan spinners exploited well the dry and dusty track, accounting for all the wickets that fell in the South African second innings.
Off-spinner Dilruwan Perera picked an impressive 4-79 while Rangana Herath took 2-84.
Perera struck early into the second session, claiming the big wicket of Amla, who is leading South Africa for the first time in Test cricket.
Amla (22) mistimed his flick and lobbed the ball to a diving Upul Tharanga for his second cheap dismissal in the game.
Faf du Plessis (37) fell to a turner from Herath that crashed on to his stumps, dislodging the bails.
De Villiers frustrated the spinners with his shot-making until his stumps were shattered by Perera close to the tea break.
De Kock fell on the last ball before the break, lobbing an easy return catch to Perera.
Opener Dean Elgar, who made 103 in the first innings, was the first batsman to fall as he tried to go for an ambitious drive off Herath but nicked it behind to wicketkeeper Dinesh Chandimal.
Alviro Petersen (32) was given caught behind off Perera but the batsman asked for a review. TV replays remained inconclusive and in the end the decision of on-field umpire was upheld.
The batsman walked off the field, shaking his head in disappointment.
South Africa had wrapped up the Sri Lankan innings in the fifth over of the day with paceman Morne Morkel (3-49) sending back overnight batsman Herath for 19.
The second and final Test will be played in Colombo from July 24-28.