Hashim Amla notched his 20th test century but three wickets for 34-year-old debutant Zulfiqar Babar allowed Pakistan to restrict South Africa to 245 for eight on the opening day of the first test in Abu Dhabi on Monday.
Amla, ranked the world`s best batsman, provided another innovative display to hit 118 not out while most of his team mates showed some ring rustiness after 10 months without test cricket.
Spinner Zulfiqar, who became the second oldest debutant for Pakistan, took three wickets in the final session to turn the match back his side`s way after Amla had led a South African fightback at the Sheikh Zayed Stadium.
The seamers took three wickets in the opening session but Pakistan lost the initiative between lunch and tea with a bizarre run-out of AB de Villiers their only success.
Then, as the pitch began to turn, Zulfiqar ended a 95-run partnership for the fifth wicket by dismissing JP Duminy.
The spinner also saw Asad Shafiq take a sharp catch at second slip to dismiss Faf du Plessis for one and bowled Robin Peterson for five to finish with three for 89 off 27 overs.
Amla, who struck 13 fours, offered an early chance for a run out while risking a single but after that he proved the backbone of the innings.
Duminy made a good return after an 11-month injury absence from tests by compiling 57 before skying a top edge to Shafiq.
Earlier, Mohammad Irfan had openers Alviro Petersen (3) and captain Graeme Smith (15) caught before Junaid Khan dismissed Jacques Kallis for five.
De Villiers (19) was removed after lunch when he played an inside edge off Zulfiqar that trickled to Younus Khan at first slip.
Younus threw the ball to wicketkeeper Adnan Akmal to take off the bails while De Villiers, seemingly deep in thought in an uncharacteristic lapse of concentration, was still in an exaggerated forward pose with his back foot not behind the crease.
He was Pakistan`s only victim of the second session but the spinners came alive after tea with Saeed Ajmal also claiming a wicket.
The test is the first in a two-match series in the United Arab Emirates where South Africa face a stiff examination of their top-ranked status.
The matches are being played in Abu Dhabi and Dubai because of the security situation in Pakistan who last hosted a test on home soil in 2009.