The nine-run victory over Australia ensures that it is the Sri Lankans who progress to the three-match final of the competition rather than India.
Lasith Malinga inspires Sri Lanka to reach Tri-series final
David Hussey hit 74 runs off 74 balls in a last gasp attempt to salvage a win for Australia, but was dismissed in the first ball of the final over.
Sri Lanka needed a win in front of a large crowd of supporters at the Melbourne Cricket Ground to advance to the finals against Australia. A loss would have seen India go through.
"We lifted our game," Sri Lanka captain Mahela Jayawardene said. "I'm sure the crowd will follow us now, the lift that we got (from them), it pushed us in the last few overs."
Malinga (four for 49) claimed the important wickets of David Warner, Peter Forrest and Shane Watson to help Sri Lanka defend their total of 238.
Australia's Dan Christian earlier claimed a hat-trick among his five dismissals, but half centuries from Kumar Sangakkara, Dinesh Chandimal and Lahiru Thirimanne proved enough to guide Sri Lanka to a winning total.
Australia made an assured - albeit short lived - start to their run chase as Warner made six from six balls before being dismissed by Malinga in the third over.
Fellow-opener Matthew Wade was out two balls later after making nine off 12 balls when he was trapped leg before by Nuwan Kulasekara.
The collapse continued as Forrest was caught behind for two off Malinga in the next over, leaving Australia at 26 for three.
Watson made 65 off 83 balls before he was bowled middle stump by Malinga and Christian was caught and bowled by Sachithra Senanayake for three.
James Pattinson, who returned from injury to play his first ODI of the series, was caught by Tillekeratne Dilshan at mid-wicket for 12 off Rangana Herath and Australia's hopes looked to be fading when Clint McKay was run out for six two overs later.
David Hussey hit a big six into the stands in the 48th over to leave Australia needing 17 runs off 17 balls, but Xavier Doherty popped a catch to Dilshan off Malinga in the next over to leave the target at 13 runs off 10 balls.
"A brilliant game of cricket," Watson said "You never knew who was going to win. Dave Hussey batted beautifully, as he's shown through the summer so far."
Allrounder Christian earlier had figures of five for 51, while paceman Pattinson took four for 51 as Sri Lankan opening pair Jayawardene and Tillekeratne Dilshan got the tourists off to a poor start after Jayawardene won the toss and elected to bat.
Jayawardene (five) was run out in the second over, as he attempted a risky single and was beaten by a David Hussey direct hit.
Pattinson claimed his first wicket a short time later when he had Dilshan (nine) caught behind.
Sangakkara and Chandimal then combined to steady the innings, while building up the run rate with a 123-run third-wicket partnership.
Sangakkara was eventually caught at deep square leg by Forrest off Pattinson for 64 and Chandimal became Pattinson's third victim when he was caught by Clint McKay at mid-off. His 75 came off 84 balls with three fours and a six.
Dan Christian removed Angelo Mathews for five when Doherty claimed an athletic running catch near the mid-on boundary.
Perera (5) was caught off a Christian ball two overs later on the deep mid-wicket boundary by Michael Hussey, who grabbed the ball, threw it into play and re-caught it to save six runs.
Christian struck again with the next ball to trap Senanayake leg before for a duck and completed the hat-trick when he dismissed Kulasekara in similar fashion without scoring.
Thirimanne was out for 51 in the 49th over when he played a Pattinson ball onto his stumps, and Christian completed his five-wicket haul by bowling Malinga for two with the last ball of the innings.