Fawad Alam’s third test century put Pakistan in charge on the second day of the first test against South Africa on Wednesday.
The 35-year-old Alam hit nine fours and two sixes in a patient 109 off 245 balls, compiled in just under six hours, to help his team reach 308-8 at stumps.
Faheem Ashraf also scored a fluent 64 off 84 balls as Pakistan opened up a first-innings lead of 88 runs on a slow wicket. He and Alam shared a stand of 102 for the seventh wicket.
Alam, who bats in an unorthodox style and exposes all three stumps to the bowler, was out in the last session when he flicked a ball from Lungi Ngidi (2-55) straight to mid-wicket.
Pakistan was in trouble overnight on 33-4 after South Africa had been skittled out for 220 on an eventful first day when 14 wickets fell on an uneven wicket.
But Alam showed lots of determination to keep the Proteas at bay. The home team went close to dismissing him for 35 just before lunch when Dean Elgar failed to hold onto a sharp low catch in the slips.
Alam had long been ignored by Pakistan after scoring a debut test hundred against Sri Lanka in 2009.
He finally got his chance against England last year and the left-handed batsman made his second test century, 11 years after his first, against New Zealand last month.
On Wednesday, Alam shared a 94-run, fifth-wicket stand with Azhar Ali (51) before his partner was caught behind off left-arm spinner Maharaj (2-71).
Mohammad Rizwan then made 33 until he was removed by Ngidi.
Alam reached his century by lofting Maharaj, who shared the new ball with Kagiso Rabada (2-45), over long on for his second six.
Ashraf, who smashed Rabada for two boundaries in an over with the new ball, was dismissed when he dragged a full delivery from Anrich Nortje (2-84) onto the stumps.