(CNN) -- Captain Graeme Smith ground out a potentially match-winning century to put South Africa on top in the third cricket Test against England at Newlands on Tuesday.
The left-hander was unbeaten on 162 at stumps on the third day, having added a record 230 for the second wicket with Hashim Amla (95) as the home side reached 312-2 in Cape Town's intense heat.
England struggled from the outset, losing two wickets in the day's opening over and added just 32 runs to their overnight total of 241-7.
That gave the Proteas a first-innings lead of 18 runs, and it looked like the home side might also find batting difficult when makeshift opener Ashwell Prince continued his miserable series, falling leg before wicket to spinner Graeme Swann for 15.
But Smith and Amla set about the English attack, who gained no profit from a controversial incident when seamer Chris Broad stood on the ball with his studded boots before lunch when it was still relatively new.
Smith survived a series of close calls and decision referrals as the duo set a new Test highest mark for the second wicket at the venue.
The opener thought he was out soon after reaching his 19th century in the five-day format, but England wicketkeeper Matt Prior admitted that the edge off seamer Graham Onions had not carried.
Amla finally fell to a bat-pad catch by Alistair Cook off Swann, falling five runs short of his eighth Test ton as he hit 14 boundaries off 156 deliveries.
First-innings centurion Jacques Kallis was unbeaten on 20 at stumps, with Smith having plundered 22 boundaries in his 243 balls at the crease.
Earlier, Morne Morkel (5-75) took two wickets in two balls to put England on the back foot, with Swann caught at slip by Smith for five from a fierce rising delivery and James Anderson following in identical fashion.
Prior, who was 52 overnight, hit out to get England close to parity before dragging a short ball from Dale Steyn (4-74) onto his wicket to be last out for 76.
England coach Andy Flower said Wednesday's morning session would prove vital for his side, who lead 1-0 after winning the second Test.
"We have got to attack with the new ball. We have seen wickets fall early on all the days so far. We have definitely got to attack early," the former Zimbabwe international player said.
"The first two days produced very difficult batting conditions, today was easier. We don't know what sort of conditions are going to arrive tomorrow. If it plays as easy as it has today, we have got a chance."