PALLEKELE, Sri Lanka (AP) " Batsman Kusal Mendis' fighting maiden test hundred backed up by quality spin bowling from Rangana Herath and Lakshan Sandakan led Sri Lanka to only its second test victory against Australia on Saturday.
Chasing 268 to win the match Australia was bowled out for 161 in the second session of the final day handing the hosts a comfortable 106-run win against the No. 1 ranked team coming from behind.
The victory is only the second for Sri Lanka against Australia in 27 tests. Australia has won 17. The last victory for Sri Lanka came in 1999 under Sanath Jayasuriya's captaincy.
Sri Lanka was bowled out for 117 runs in its first innings and Australia gained an 86-run lead by scoring 203 in its first innings.
Mendis hit 176 to turn Sri Lanka's fortunes around as the hosts scored 353 in its second innings. He was named player of the match.
Herath took nine wickets in the match including five for 54 in the second innings, his 24th five-wicket haul. Sandakan took a match haul off seven wickets on his test debut troubling the more experienced batsmen.
After Australia lost eight wickets for 157 shortly after lunch on Saturday Peter Nevill and Steve O'Keefe resisted valiantly frsutrating the Sri Lankans.
With O' Keefe left out of the remainder of the series because of a hamstring injury that made running between wickets difficult, the pair batted out 22.5 consecutive maiden overs.
Their four-run partnership for the ninth wicket lasted 97 minutes and took 178 deliveries before debutant off spinner Dhananjaya de Silva had Nevill caught behind for nine.
Later Herath bowled O' Keefe out to seal the match that came as a relief for the Sri Lankans who had lost six of the last seven test series. They could only beat a below par West Indies last year.
"After a rough, tough six to eight months we needed this victory and that give us a lot of confidence going forward," Sri Lanka captain Angelo Mathews said after the match.
"We are humbled by the victory but still have a long way to go."
Mathews credited 21-year-old Mendis for the change in fortunes.
Australia captain Steve Smith said that his batsmen failed to capitalize after a good bowling effort that saw Sri Lanka being dismissed for a low score in the first innings.
"I thought we were in a really good position to get a much bigger lead than 86. We didn't push on as much as we would have liked," Smith said.
"I guess in the third innings of the match we didn't do a great deal of wrong, I think Kusal Mendis played an exceptional innings of 176 and that took the game away from us."
Smith said he is disappointed with yet another poor show in Asia.
Since winning its last three-match series in Sri Lanka 1-0 five years ago, Australia lost its matches in a series against Pakistan in the United Arab Emirates and on a tour of India " 2-0 and 4-0 respectively.
"It's disappointing," Smith said. "As I said before the game we hadn't played all that very well in the sub-continent conditions for a while now and it's something that under my captaincy I sort of want to change."
The final day began with equal chances of winning for both sides with Australia needing 185 runs with seven wickets in hand and Sri Lanka encouraged by a spin-friendly pitch.
Herath took three wickets in a rain-shortened morning session dismissing Adam Voges (12) caught and bowled, Mitchell Marsh (25) and captain Smith (55) both lbw.
Fellow spinner Sandakan took a return catch to dismiss Mitchel Starc to end the morning session.
Smith brought up his 17th half-century cautiously facing 125 deliveries and hitting only one boundary. He successfully reviewed a catch behind decision against him at 54 but failed to capitalize on the reprieve.
Voges straight drove Herath in the eighth over of the day which appeared to come off the pitch. But on appeal for a return catch the television umpire confirmed that the ball hadn't hit the ground before being caught.
This story has been automatically published from the Associated Press wire which uses US spellings