Cape Town - Seamer Vernon Philander has steadied the Proteas after their batting collapse on the opening day of the third and final Test against Pakistan at the Wanderers.
At stumps, Pakistan were 17/2, leaving with a first innings deficit of 245 runs.
Pakistan's bowlers changed the course of the third and final Test against South Africa when they engineered a dramatic collapse on Friday.
From being in control on 226 for three at tea, South Africa were bowled out for 262 at the Wanderers Stadium.
Philander struck back for South Africa, taking two wickets off successive balls as Pakistan reached 17 for two at the close.
SCORECARD: Proteas v Pakistan, 3rd Test - Day 1
A polished innings of 90 by Aiden Markram, coupled with some wayward bowling by Pakistan, laid the foundation for some attacking batting by South Africa, who collectively hit 37 fours and a six before tea on what looked the best batting pitch of a series already won by the hosts.
But the runs dried up after the interval as South Africa were able to add only 36 for the loss of seven wickets in 19.4 overs, hitting only four more boundaries.
Mohammad Amir and Mohammad Abbas set the tone after tea, taking two and one wickets respectively. Both bowlers gained reverse swing and tightened up their lines to make run-scoring difficult.
READ:'Mr 100' ... Zubayr Hamza crowns a ton of Proteas
Amir left the field four balls into his 16th over after falling in his delivery stride and appearing to twist his left ankle but Hasan Ali and Faheem Ashraf continued to put pressure on the batsmen.
Ashraf finished with three for 57, while Amir, Abbas and Hasan took two wickets each.
Markram hit 16 boundaries off 124 balls in an innings marked by crisply-struck drives and firm clips to leg.
It was the third time in his 15-Test career that he had been dismissed in the nineties.
Markram, who had to pass a fitness test after suffering a badly bruised right thigh while fielding in the second Test in Cape Town, looked set for his fifth Test century until he glanced a ball from the medium-paced Faheem and wicketkeeper Sarfraz Ahmed dived to his left to take a good catch.
Hashim Amla (41) helped Markram put on 126 for the second wicket after stand-in captain Dean Elgar was caught behind off Mohammad Abbas for five in the second over.
Theunis de Bruyn (49) and new cap Zubayr Hamza (41) both batted brightly in a fourth wicket stand which was worth 72 off 92 balls at tea.
But De Bruyn was out in the third over after tea and Hamza, who scored 38 off 46 balls before tea, could add only three more runs off 22 deliveries before he was caught behind off Amir.
Left to negotiate a tricky 40 minutes before the close, Pakistan lost Shan Masood, their top scorer in the series, for two when a successful review by South Africa showed he had got a faint edge to a ball angled across him.
Azhar Ali received a superb first delivery which seamed way from him and found an edge for wicketkeeper Quinton de Kock to take a second catch.
Scores in brief after Day 1:
South Africa 262 (Markram 90, De Bruyn 49, Ashraf 3/57, Amir 2/36)
Pakistan 17/2 (Imam-ul-Haq 10*, Masood 2, Philander 2/1)
South Africa won the toss and opted to bat first