(CNN) -- A commanding 162-run knock by Tillakaratne Dilshan allowed Sri Lanka to recover from a shaky start against Bangladesh and reach a healthy score at stumps on day one of the second Test.
Dilshan celebrates his century as Sri Lanka ended the first day in Chittagong in a healthy position.
Dilshan enjoyed century stands with Malinda Warnapura and Chamara Kapugedera as the tourists hit back from a precarious 75 for four to post 371 for six at the close in Chittagong.
The right-hander was eventually bowled by Enamul Haque shortly before the end of play, but Kapugedera was unbeaten on 93 and will be looking to add his own century to the scoreboard when the contest resumes on Sunday.
Things had looked very different for Sri Lanka earlier in the day when Bangladesh, who are 1-0 down in the two-Test series, had reduced their opponents to 65 for three at lunch.
Mashrafe Mortaza struck with just the fourth ball of the match when the right-arm bowler got a delivery to move back into Prassana Jayawardene and the opener was trapped lbw without scoring.
It got even better for both Bangladesh and Mortaza as he claimed the crucial scalp of Kumar Sangakkara in the third over when he played onto his own stumps with an inside edge to leave Sri Lanka seven for two.
Warnapura and captain Mahela Jayawardene, playing in his 100th Test match, looked to repair the damage but it was slow going and the latter was dismissed for 11 when he edged slow left-armer Shakib Al Hasan to wicketkeeper Mushfiqur Rahim with the score on 39.
Warnapura and Thilan Samaraweera saw Sri Lanka through to the interval, but the latter lasted just 10 balls of the second session before he was bowled by Shahadat Hossain.
The tourists were beginning to look vulnerable but Dilshan's arrival at the crease quickly changed things. While Warnapura was pedestrian in reaching his fifty from 133 balls, Dilshan smashed eight fours and a six to bring up his half-century from just 37 deliveries.
Warnapura had hit 63 when he was trapped leg before by Mohammad Ashraful, but Dilshan continued to punish the Bangladesh bowlers to reach tea just five runs short of the century mark.
Kapugedera had also added a useful 26 by the interval and the duo carried on where they had left off in the final session as Bangladesh felt the full force of their batting.
Dilshan soon got the runs he needed to complete his sixth Test century while Kapugedera reached the 50-mark with a boundary off Hossain in the 71st over.
The century partnership quickly followed and the runs continued to flow as the Bangladesh bowlers saw their deliveries smashed all over the ground.
With the close of play approaching, it was Haque who eventually made the breakthrough with a ball which turned onto Dilshan's leg stump. Kapugedera and Chaminda Vaas guided Sri Lanka safely through the last four overs of the day.