Australia weathered an early storm from South Africa to record a 25-17 victory in Sydney as George Gregan and Stephen Larkham made their final international appearances on home soil.
The Springboks got off to a dream start with two tries in the opening seven minutes and added a subsequent penalty to race into 17-0 lead early in the first half.
But the Wallabies regained their composure to close to within 17-10 at the break before adding a further two tries in the second half to secure an unconvincing Tri-nations victory.
South Africa opened the scoring in the sixth minute when flanker Wikus van Heerden crashed over from short range on the back of some excellent lead up work from his pack.
A minute later an errant Nathan Sharpe pass landed in the hands of dynamic veteran Breyton Paulse, who ran 50 metres to silence the home crowd.
Derick Hougaard's 16th-minute penalty - awarded after Sharpe was caught in an offside position - extended the lead to 17-0.
The Wallabies capitalised on their first possession of the match in the Springboks half with an enterprising backline move that saw Mark Gerrard cross for their opening five-pointer in the 21st minute with Mortlock's conversion making it 17-7.
It was all the Wallabies for the remainder of the half and they narrowed the gap to just seven with a Mortlock penalty in the 37th minute.
They continued their momentum when man-of-the-match Stephen Hoiles crossed for a converted try to level the scores at 17-17 just three minutes after the break.
The Wallabies remained in the ascendancy with a penalty goal in the 51st minute making it 20-17 and assumed greater control when Gary Botha was sin-binned in the 53rd minute after repeated South African infringements.
The home side capitalised on the extra man in the 55th minute when Matt Giteau gathered a delicate kick from Gerrard to make it 25-17 and seal the win.