Sri Lankan spinner Rangana Herath backed up centurion Kusal Mendis' superlative effort to stun top-ranked Australia by 106 runs in the rain-affected first Test in Pallekele on Saturday.

Herath finished with impressive match figures of 9-103 to help the hosts bundle out Australia for 161 on the fifth and final day.

The visitors, who made 203 in their first innings, had been chasing a challenging 268.

Australian skipper Steven Smith provided some resistance with a gritty half-century before Steve O'Keefe and Peter Nevill frustrated Sri lanka with a 178-ball partnership.

Herath bagged the last Australian wicket to fall by cleaning up O'Keefe, triggering wild celebrations in the Sri lankan camp.

This was only Sri Lanka's second Test win against Australia in 27 matches.

It was batsman Mendis (176) who set up the unlikely win for Sri Lanka with his superb maiden ton in his team's second innings after the hosts overcame an 86-run deficit.

Sri lanka lead the three-match series 1-0 as the action shifts to Galle for the second Test beginning August 4.