There was a flurry of wickets after tea but De Villiers counter-attacked to hit 74 not out off 81 balls with easily the most aggressive batting of an otherwise slow day.
South Africa's quest for a series-levelling win was given added impetus by a pending disciplinary hearing which could result in fast bowler Kagiso Rabada being banned for the remaining two Tests after his shoulder made contact with Australian captain Steve Smith on Friday.
But the scoring was painfully slow and Australia were right back in the game when both batsmen were dismissed in the first two overs after tea, followed by two more batsmen being dismissed cheaply.
The Australian bowlers made effective use of reverse swing, firstly to restrict the scoring and then as a weapon in all four wickets.
Amla was bowled by a fast, reverse swinging yorker from Mitchell Starc for 56 four balls after tea and Elgar was caught behind off Josh Hazlewood for 57 in the next over. Like Amla, Elgar fell to a full delivery which swung late.
While other batsmen had struggled to gain any momentum to the South African innings, De Villiers looked at ease and played strokes to all parts of the ground in reaching a half-century off 62 balls with ten fours. By the close he had faced 81 balls and hit 14 boundaries.
Australia delayed taking the second new ball until the 90th over but De Villiers and Vernon Philander survived until the close.
Only 43 runs were scored in 26 overs between lunch and tea after a slightly less pedestrian morning during which 71 runs were scored in 28 overs.
Opening batsman Elgar, renowned for his gritty defensive qualities, was even slower than usual, taking 164 balls to reach his fifty. He was out for 57 after facing 197 deliveries and hitting six fours.
His only boundary during the afternoon came from an edge against Mitchell Marsh to raise his half-century.
Amla, normally more fluent, took 122 balls to reach fifty and went on to make 56 off 148 deliveries with six fours.
Amla was twice given out leg before wicket, on seven against Pat Cummins and on 40 against Hazlewood, but survived on review on both occasions.
(This story has not been edited by Business Standard staff and is auto-generated from a syndicated feed.)