South Africa's captain Graeme Smith comes onto the field for the last time after announcing his retirement, during the fourth day of their third cricket test against Australia in Cape Town. (AP Photo)

Cape Town - Graeme Smith made three in his final test innings as South Africa were slipping towards a heavy defeat at the close on the fourth day of the series-deciding third test against Australia on Tuesday.

Chasing a victory target of 511, the hosts will resume on 71 for four wickets on the final day despite a valiant effort from AB de Villiers and Hashim Amla who survived 31 overs before the latter was out 20 minutes before stumps.

South Africa had lost openers Smith and Alviro Petersen (nine), as well as Dean Elgar (nought), as Australia were rampant before tea.

Smith flicked a rising Mitchell Johnson delivery on to his thigh and the ball looped gently to Alex Doolan at short leg, an inglorious end for one of the game's greats who was given a guard of honour by the touring side as he came out to bat.

It was a tame way for Smith's 205th test innings to finish but it was in keeping with his poor form in a series in which he has scored just 45 runs in six innings.

The South African captain, who announced his retirement from international cricket late last night, bowed out having made 9,265 runs at an average of 48.25 in 117 tests, 109 of those as captain.

De Villiers has survived 100 balls for his 16 with all thoughts of scoring gone and survival the only thing on his mind.

He and Amla added 53 for the fourth wicket off 184 balls, a stand ended when Amla was trapped lbw by a reverse-swinging delivery from James Pattinson.

De Villiers will resume on Wednesday with nightwatchman Kyle Abbott (one) hoping for a repeat of their performances in Adelaide and Johannesburg in the last 18 months where they batted for 148 and 136 overs respectively in the fourth innings to seal draws.

Faf du Plessis, who will bat next, scored battling centuries in both those innings to steer the Proteas to safety.

The struggles of the home side were in sharp contrast to the Australia innings, when David Warner made batting look easy as he bludgeoned 145 from 156 balls and the tourists declared their second innings on 303 for five.

It was a second century of the match for the left-hander, who took his runs total in the series to 543 at an average of 91.

Warner received support from Chris Rogers (39) and Steve Smith (36 not out), but was the dominant figure in all his partnerships as he scored nearly half his side's runs.

Abbott was the most successful South Africa bowler with figures of three for 61, including the wicket of Warner who edged a slower ball to wicketkeeper De Villiers.