Australia's Commonwealth Bank Series match against Sri Lanka was delicately poised going into the final 25 overs, with the visitors making hard work of a modest chase at the WACA Ground on Friday.
Sri Lanka were 3-106 after 25 overs, chasing 232 for victory, with Dinesh Chandimal not out on 25 off 37 and Mahela Jayawardene unbeaten with 12 off 11.
They appeared to be cruising at 1-61 and 2-88 but untimely wickets and Mitchell Starc's ferocious new ball spell, which saw him take 1-11 off five overs, helped keep Australia in the contest.
Even after Starc (1-20 off seven overs) took the early wicket of Upul Tharanga for five and did a fantastic job in keeping the scoring rate down in the early overs, Sri Lanka were establishing control before a woeful miscommunication saw Kumar Sangakkarra run out for 22.
Ryan Harris then took the valuable wicket of opener Tillakaratne Dilshan for 40 to give Australia a chance going into the final overs.
Sri Lanka's required run-rate over the final 25 overs to earn their first win of the one-day international tri-series was 5.04.
Australia could only set a modest target after a top order collapse saw them bowled out for just 231, a total they only reached after valuable tail-end efforts from Starc and Clint McKay (25 off 25).
Michael Clarke top-scored for the hosts with 57 off 88, while David Warner (34) and Daniel Christian (33) made modest contributions as Australia struggled to deal with an impressive Sri Lankan bowling effort after being sent in to bat.
Angelo Mathews (2-37 off nine overs) and Nuwan Kulasekara (2-39 off 10) were the pick of the Sri Lankan bowlers, but Lasith Malinga, Sachithra Senanayake and Dhammika Prasad also claimed two scalps each.
Early in the chase, Starc's swing caused Sri Lanka's openers no end of concern and the left-armer received his reward when Tharanga couldn't judge the movement of a delivery and edged it to first slip Michael Clarke.
The visitors were cautious in the opening power play, scoring just 31 runs from the first 10 overs as they battled Starc's unpredictable swing, but they progressively lifted the scoring rate once the fielding restrictions ended.
Sri Lanka seemed to be taking control with two set batsman at the crease and a manageable required rate, but they undid much of their hard work when Sangakkara was left stranded in the middle of the wicket and run out by a McKay direct hit.
After Dilshan and Chandimal put on 27 runs for the third wicket, the former captain was caught behind to get Australia back into the contest.
Harris (1-38 off eight overs) and Clint McKay (0-20 off four) were among Australia's better bowlers.