Sri Lanka, chasing 232 for victory, looked dead and buried after slumping to 9-180 in the 45th over.
But a resilient 46-run partnership between vice-captain Angelo Mathews (64 off 76) and tail-ender Dhamika Prasad (15no off 11) lifted Sri Lanka to within sight of victory.
Sri Lanka needed 18 runs off Mitchell Starc’s final over, but the equation became a more manageable eight off four balls after Mathews cracked a six and a four.
But needing six off the final two balls, Mathews was caught by a composed Dan Christian in the deep after skying one into the air.
Michael Clarke top-scored with 57 in Australia’s modest total of 231, before claiming the scalp of Dinesh Chandimal (37) at an important time to help dismiss Sri Lanka for 226 in 49.5 overs.
Spinner Xavier Doherty also played a key role, snaring 2-24 from 10 overs to put the breaks on Sri Lanka’s run chase in front of 13,085 fans.
All-rounder Dan Christian, who scored 33 with the bat, was also important with two wickets.
Australia, who opted against handing Peter Forrest his debut, will be aiming to make it three wins on the trot when they take on India (1-1) at Adelaide Oval on Sunday.
Sri Lanka were cruising at 1-61 in the 15th over before paceman Clint McKay produced a brilliant piece of fielding to run out Kumar Sangakkara for 22.
After playing McKay to short square leg, Sangakkara slipped mid-pitch after being sent back by batting partner Tillakaratne Dilshan.
That was all the time needed by McKay, who scooped up the ball and threw down the stumps in the one motion to find Sangakkara well short of his crease.
Sangakkara sent a fierce glare Dilshan’s way as he trudged off the field, and Dilshan didn’t last much longer before edging Ryan Harris through to the keeper for 40.
And when Clarke trapped Chandimal in front to reduce Sri Lanka to 6-129 in the 31st over, the looked over – only for Mathews to inspire a remarkable fightback.
Earlier, Australia’s top order failed in the 40-degree heat after Sri Lanka won the toss and surprisingly elected to bowl.
Matthew Wade and Ricky Ponting were dismissed for one, while David Warner looked good before being bowled for 34.
Clarke, who plundered 626 runs at an average of 125.20 during the recent Test series win over India, combined with Christian to lift Australia from a precarious 5-130 to 5-186.
But their dismissal within four runs of each other – followed soon after by the demise of Harris – left Australia in all sorts of trouble at 8-192, before tail-enders McKay (25) and Starc (14) added handy runs.
“I’m getting a few more greys, that’s for sure,” Clarke joked after the match.
“Against these two teams, India and Sri Lanka, they’re never out of it. You can’t take your foot off the gas.
“A lot of credit needs to go to our bowlers. For the first 45 overs of the game, we bowled beautifully.”
Mathews said it was disappointing to lose after working the team back into the contest.
“I really thought that we had it, because it was just six runs from two balls. We were just one shot away from victory,” Mathews said.
“I never expected a bumper from Starc, I was waiting for the yorker.
“But then he bowled a bumper, and I was a bit surprised but I had to go for it.” (AAP)