New Zealand completed a 2-1 series victory with a 55-run win.
McCullum's farewell seemed likely to be soured by a dramatic batting collapse which saw New Zealand lose its last six wickets for 23 runs to be all out for 246, but the bowlers pulled out a victory by dismissing Australia for 191 with more than six overs to spare.
Australia had been on target for victory when on 164-5 but the controversial dismissal of Mitch Marsh — with his inside edge adjudged to have come off his boot for a caught-and-bowled — exposed the tail and New Zealand's bowlers quickly wrapped up the win.
New Zealand beats Bangladesh by 8 wickets in 3rd ODI