South Africa thrashed Australia by 309 runs in the third Test to hold on to their number one Test ranking and ruin a farewell for Ricky Ponting.
Set a mammoth target of 632 runs to win, Australia lost their first wicket on the second ball of the fourth day and were eventually dismissed for 322 as the Proteas sealed the three-Test series 1-0.
Graeme Smith's South Africans became the first team in two decades to defeat Australia on home soil in consecutive tours, with the West Indies the previous team to achieve it in 1992-93.
And they achieved it with sporting good grace after forming a highly unusual guard of honour for Ponting (37) Test cricket's second highest run-scorer, as he emerged for his final innings.
"I was a little bit embarrassed and wish it didn't happen that way, but it was an amazing gesture by Graeme and the South African team," Ponting said.
In their 200th Test since being allowed back into international cricket, South Africa were only denied their biggest ever victory in a match decided in the fourth innings by a defiant 87-run last-wicket stand.
Number 10 Mitchell Starc smashed an unbeaten 68 off 43 balls to share in the highest-ever last wicket partnership at Perth's WACA Ground with Nathan Lyon 31 off 43 balls.
South Africa's win also continued their remarkable away record, with the Proteas not beaten in an away series since losing 2-0 in Sri Lanka in 2006. They have lost none of their three Tests at the WACA, with two wins and a draw.
The Australians went into the match as the form side in the two prior drawn Tests, and they were determined to send Ponting off on a high note with a win which would have made them the top-ranked side in Test cricket.
However, they were never in the hunt after a poor effort on the second day, when they collapsed with the bat and then bowled poorly.
Australia needed to produce an unprecedented run chase to win the match, but that never looked a possibility after David Warner (29) fell to Vernon Philander (2-41) in the first over of the day.
In his 168th and final Test, Ponting came to the crease at 81 for two, but the fairytale ending did not materialise and he made just eight in his last innings.
The former captain got off the mark with a trademark pull shot for four off Morne Morkel from the sixth ball he faced.
However, he lasted only 23 deliveries and 40 minutes before falling in unlikely fashion to spinner Robin Peterson, just minutes before lunch.
He was caught at first slip by Jacques Kallis attempting to force Peterson off the back foot.
"I've been lucky to play as many Tests as I have and cherished every moment, it was always going to end at some stage I guess," Ponting said.
Ponting stopped his walk back to the pavilion to raise his bat and acknowledge the crowd, while the Proteas halted their celebrations to offer more applause.
He finished his career with 13 378 Test runs at 51.85, including 41 centuries, but with just 32 runs in his last series at 6.40.
Ponting also shares the record of 168 Test appearances for his country with his predecessor as Australian captain, Steve Waugh.
Michael Clarke and Mike Hussey briefly steadied the Australian ship with a 58-run stand for the fifth wicket, before both fell in quick succession just before tea as the Proteas turned the screw.
Clarke was stumped off the bowling of Peterson (3-127) for 44, while Hussey became the 13th Australian to pass 6 000 Test runs before being caught behind for 26 from the bowling of Dale Steyn (3-72). - Sapa-AFP