COLOMBO, Sri Lanka (AP) — Left-arm spinner Keshav Maharaj claimed career-best figures of eight for 116 as South Africa restricted Sri Lanka to 277 for nine by stumps on the opening day of the second Test match at the Sinhalese Sports Club grounds on Friday.

Maharaj's figures are the third best against Sri Lanka by any opposition bowler following Imran Khan's eight for 58 in Lahore and Shannon Gabriel's eight for 62 in St. Lucia last month.

After a promising start where the openers put on 116 runs for the first wicket, Sri Lanka collapsed as Maharaj bowled a probing line. In a bid to strengthen their batting after their poor show in Galle, the tourists went into the game with a lone spinner, leaving out Tabraiz Shamsi and they may have regretted the decision given Sri Lanka's troubles against the only spinner.

After electing to bat first, Sri Lanka's openers dominated the morning session. Their 116-run stand is Sri Lanka's first 100 plus partnership for the opening wicket since October 2016. Since then Sri Lanka have gone through 21 Test matches without a 100 plus partnership by the openers.

Maharaj bowled unchanged in the afternoon session and picked up both openers Dimuth Karunaratne (53) and Danushka Gunathilaka (57) in successive overs. He also accounted for Kusal Mendis to reduce Sri Lanka to 168 for three by tea.

In the final session's play, Maharaj claimed five wickets to put South Africa on top. Kagiso Rabada claimed the other wicket to fall when he cleaned up Roshen Silva for 22.

Dhananjaya de Silva top scored with 60 runs and was tested by Rabada, who reverse-swung the old ball considerably but with little success. De Silva was hit on the shoulder by a Rabada bouncer when he ducked late. Eventually, he became yet another victim of Maharaj as South Africa successfully reviewed after the appeal had been turned down by umpire Nigel Llong.

Last man Rangana Herath along with Akila Dananjaya survived 19 nervous minutes as South Africa tried to bowl Sri Lanka out on the opening day.

The new ball was taken in the 85th over and Maharaj was called up to bowl. Dale Steyn, who needs one more wicket to break the South African record for most wickets in Test cricket, shared the new ball from the other end but failed to make the breakthrough.