Hashmi Amla was unbeaten on 118 and Dale Steyn on 13 after South Africa won the toss and elected to bat. Amla notched his 20th test century.
Ranked the world's best batsman, Amla 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.
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.
Good returns
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 second and final Test will be played in Dubai from October 23.
COMMENTS (1)
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ
This currently selected Karachi B team batting lineup will totally flop against SA.