The hosts had reached 40 without loss by the close of play with openers David Warner (29) and Ed Cowan (nine) surviving a sometimes nervous last hour.
Fight for number 1After the first two Tests in Brisbane and Adelaide ended in draws, South Africa only needed a third in Ricky Ponting's last Test to ensure they remained the world's number one side.
Amla's brilliant innings was one for the purists, while de Villiers started slowly before accelerating after he reached his fifty to bludgeon the Australian bowlers with every shot in the book.
Picking up where he left off on Saturday when he helped the tourists plunder 206 runs in the extended third session, Amla got the single he needed to reach his 18th test century from the third delivery of the day.
Peppering his innings with some sublime cover drives for a good few of his 21 boundaries, Amla's comfort at the crease had echoes of his unbeaten 311 against England at the Oval in July.
De Villiers moved cautiously to his 50 but He upped the pace with a string of quickfire boundaries to reach 89, then graduated to his 14th test century in stunning style with three successive reverse sweeps for four, again off Lyon.