Melbourne: Lasith Malinga sparked a top-order collapse as Sri Lanka claimed a thrilling nine-run win over Australia to book their place in the limited-overs tri-series finals.
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 on Friday 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 (4-49) claimed the important wickets of David Warner, Peter Forrest and Shane Watson to help Sri Lanka defend their innings 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 6 from six balls before being dismissed by Malinga in the third over. Fellow-opener Matthew Wade was out two balls later after making 9 off 12 balls when he was trapped lbw by Nuwan Kulasekara. The collapse continued as Forrest was caught behind for 2 off Malinga in the next over, leaving Australia at 26-3.
Shane Watson set about restoring Australia's impetus, sharing 87 runs with Mike Hussey until Hussey was caught behind for 29 off Thirimanne.
Watson made 65 off 83 balls before he was bowled middle stump by Malinga and Christian was caught and bowled by Sachithra Senanayake for 3.
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 6 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 5-51, while paceman Pattinson took 4-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 (5) 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 (9) 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 5 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 lbw 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 2 with the last ball of the innings.