Fawad Alam put Pakistan in control of the first Test against South Africa, chalking up a superb century to lead the home side to 308 for eight by the close of day two in Karachi for a first innings lead of 88 runs.
Pakistan had been reeling on 33 for four in response to South Africa's 220 all out, but Fawad (109) tilted the match in Pakistan's favour as he demonstrated great skill and patience to compile his third test century.
Hasan Ali (11 not out) and Nauman Ali (6 not out) will resume on the third morning and look to push the Pakistan lead past 100 on a wicket that is expected to get progressively lower, slower and take more turn.
Fawad and Azhar Ali (51) put on 94 for the fifth wicket before the latter was caught by wicketkeeper Quinton de Kock off spinner Keshav Maharaj (2-71).
Mohammad Rizwan added a breezy 33 but steered seamer Lungi Ngidi (2-55) to a diving Faf du Plessis at wide first slip.
The unorthadox Fawad, who takes a bizarre front-on stance at the crease, put on a further 102 with Faheem Ashraf (64) as they took the attack to the tourists.