Khurram Manzoor scored a maiden test century as Pakistan overhauled South Africa's total on the second day of the first test in Abu Dhabi for the loss of three wickets on Tuesday.
Manzoor was unbeaten on 131 and Pakistan ended on 263 for three, a lead of 14 runs over South Africa who were bowled out for 249 early in the morning session.
Manzoor became the first Pakistan batsman in a decade to score a test century against South Africa, whose much-vaunted pace attack toiled with little success on a flat track at the Sheikh Zayed Stadium.
Playing in only his 10th test, Manzoor dealt confidently with the bowling as he and debutant Shan Masood built the foundation with an opening wicket stand of 135.
They were the first opening pair to compile a century partnership in Pakistan's last 24 test innings, the previous one coming when the side beat England in Dubai in early 2012.
Masood scored 75 before being trapped lbw by spinner JP Duminy, showing plenty of maturity as he shrugged off a barrage of short deliveries and verbal abuse from an increasingly frustrated South African attack.
The Proteas managed took two wickets in the last session, including the prize scalp of Younus Khan for one after he gloved the ball to gully attempting to fend off a short ball from Morne Morkel.
But captain Misbah-ul-Haq (44 not out) will resume on Wednesday with Manzoor after surviving a scare as South Africa took the second new ball just before close.
South Africa captain Graeme Smith claimed a catch in the slips but television replays showed it had fallen short of his fingers.
Resuming on 245 for eight, South Africa added just four runs in four overs as they lost their last two wickets cheaply.
Hashim Amla, who had been the outstanding performer of the opening day, was out to the second ball of the morning, edging to slip for 118. It was the third wicket of the innings for giant seamer Mohammad Irfan (3-44).
The second match of the two-test series starts on Oct. 23 in Dubai.