(CNN) -- Pakistan have staged a remarkable recovery in the second Test against Sri Lanka in Colombo after a maiden century from debutant opener Fawad Alam on Monday.
Opener Alam marks his century on his first Test appearance for Pakistan.
After being skittled for a humiliating 90 in their first innings, Pakistan trailed by 150 runs as they began their second knock.
But Alam shared important stands with Khurram Manzoor and captain Younis Khan as Pakistan were 178 for one by the close of the second day, a lead of 28.
Alam, who put on 85 for the first wicket with Manzoor, was 102 not out with Younis on 35 not out.
He closed on his century with a six off spinner Rangana Herath, before pulling him for a two to reach the landmark.
He had put on 93 with Younis and they will look to extend the slender overall lead on a crucial third day in the Sri Lankan capital.
Pakistan were in dire straights overnight with the hosts leading by 74 runs with seven first innings wickets in hand.
But paceman Umar Gul and spinner Saeed Ajmal took four wickets apiece to restrict the home side to 240, the last seven wickets going for just 76.
Gull took the key wicket of Sri Lanka captain Kumar Sangakkara, who missed out on his century when he was bowled between bat and pad 87.
It was a much-needed morale-boosting performance by World Twenty20 winners Pakistan, who crashed to defeat in the first Test in Galle while chasing a moderate victory target.