Rangana Herath took nine wickets in the match as Sri Lanka completed a remarkable turnaround to seal only their second Test victory over Australia with a 106-run triumph in Pallekele and take a 1-0 lead in the three-match series.
Australia needed 185 runs to win with seven wickets intact on day five, but Herath led the way with 5-54 to ensure Sri Lanka pulled off a result which looked so unlikely after they were skittled out for only 117 on day one.
Captain Steve Smith (55) was the only batsman to score a half-century in the match for the top-ranked Test side, who lost to Sri Lanka for the first time in the longest format since back in 1999.
Impressive debutant Lakshan Sandakan took 3-49 on a tense final day after claiming 4-58 in the first innings, playing a key role in enabling Sri Lanka to end a run of five Tests without a win and consigning Australia to their first Test loss in 10.
Kusal Mendis had set the foundations for Sri Lanka's long-awaited victory with a magnificent 176 and the spinners finished off the job on Saturday as Australia's poor form in Asia continued.
Adam Voges was the first to go when wily left-armer Herath had him caught and bowled for 12 to reduce the tourists to 96-4.
Skipper Smith and Mitchell Marsh (25) gave Australia hope with a fifth-wicket stand of 43, but the latter became Herath's next victim after the veteran got one to slide on with the arm and was given the verdict following a review.
Smith was given out caught behind in the next over from Sandakan, but the decision was overturned as there was a clear gap between bat and ball.
There was no saving Smith, who scored just one boundary in a patient knock, when Herath trapped him in front in the following over and Australia were 141-7 at lunch after Sandakan did for Mitchell Starc (0).
Nathan Lyon (8) was dropped by Nuwan Pradeep, but it seemed the end was nigh when Sandakan got his man leg before with one that turned sharply from outside off stump.
However, Peter Nevill and Steve O'Keefe, unable to run between the wickets due to a hamstring injury, showed great resistance to frustrate Sri Lanka in a partnership which lasted almost 30 overs in which they added only four runs.
O'Keefe had a huge stroke of luck when he was given not out after being caught at short leg and Sri Lanka had no reviews left, but debutant Dhananjaya de Silva (1-12) had Nevill caught behind to get the breakthrough.
Herath deservedly claimed a five-wicket haul when he bowled O'Keefe to wrap up a magnificent victory.