Cape Town - David Miller and Faf du Plessis plundered big-hitting centuries in a batting masterclass as South Africa beat Australia by 40 runs to win their one-day series and inflict another defeat on Justin Langer's misfiring side.

SCORECARD: Australia v South Africa, 3rd ODI

The pair shared in a 252-run stand to power the Proteas to 320-5 in the third and final match in Hobart -- a record fourth wicket partnership by South Africa against the hosts in Australia.

They came together at 55-3 in the 16th over with Miller swatting 139 for his fifth limited-overs century and skipper du Plessis smashing 125 -- his 10th one-day ton.

A composed Shaun Marsh cracked a fighting 106 in the run chase, ably supported by Marcus Stoinis (63) and Alex Carey (42) -- an improvement on recent batting displays but still not good enough.

Pace spearheads Kagiso Rabada and Dale Steyn both took three wickets in controlled and disciplined spells.

The victory handed South Africa their first ODI series win in Australia since 2009 and left Australia with plenty to ponder ahead of India's arrival this month for a three-format tour.

"I thought we played our best game of cricket (of the tour)," said du Plessis after clinching the series 2-1.

"We challenged ourselves to put in a performance. From a batting point of view we were good, but from a bowling point of view we were excellent."

Australian captain Aaron Finch praised the partnership between Marsh and Stoinis, but admitted the South African attack was too hot to handle.

"They bowled exceptionally well at the end, credit to them in the last 10 overs," he said.

"After 35 overs we were in a great position but they took it away at the end."

Both sides opted for unchanged line-ups after Australia snapped a seven-game losing streak to clinch the second match in Adelaide on Friday by seven runs. South Africa easily won the first in Perth by six wickets.

After winning the toss and putting the visitors into bat, Australia got a dream start with Quinton de Kock out in the third over.

Mitchell Starc did the damage, bowling a perfect line and length, with de Kock getting a tickle on the ball and wicketkeeper Carey taking the catch.

Aiden Markram smashed three sixes, including one huge blow off Marcus Stoinis that went out of the ground and down the street, with a new ball needed, on his way to 32.

But as he looked set for a big score, he flicked a Starc delivery down leg side to Carey, leaving South Africa struggling.

Then hard-hitting Miller joined skipper du Plessis and the scoreboard began racing along.

Du Plessis was dropped on 29 and Miller escaped an lbw dismissal on 41 that was overturned on review.

They made the most of their second lives and began swinging their bats as du Plessis reached his century in 105 balls with 11 fours and one six before falling to Stoinis going for another big hit at the death.

Miller made the landmark in 95 balls, including eight fours and two sixes, and was finally caught at deep midwicket off Josh Hazlewood in the last over.

Australia experimented with Chris Lynn as opener for the run chase, but it spectacularly backfired when Steyn snared him for a golden duck.

Australia's woes were compounded when Aaron Finch soon followed him back to the pavillon.

It was down to Marsh and Stoinis to open their shoulders and look for boundaries. They put on an impressive 107 before Stoinis was caught at backward point.

Carey supported Marsh as he made his sixth one-day ton in 98 balls, with six fours and four sixes, before he was caught at deep midwicket and hope began to evaporate.