Kevin O'Brien scored Ireland's first Test hundred when he reached three figures against Pakistan on the fourth day of their inaugural match at this level at Malahide on Monday.

A two off left-arm quick Mohammad Amir saw O'Brien to his hundred in 186 balls, including 10 fours - a shot greeted with cheers from a crowd of several hundred.

It was the 34-year-old O'Brien's first century for Ireland since he made the fastest-ever World Cup hundred by any batsman, off 50 balls, against England at Bangalore in 2011.

Ireland, made to follow-on, were in danger of a heavy defeat when O'Brien, who top-scored with 40 in their first-innings 130, walked in at 95 for four on Monday.

But he retained his composure to complete a fifty off 100 balls - the exact reverse of the figures in his record-breaking feat in India seven years ago.

O'Brien, whose older brother Niall is Ireland's wicket-keeper, received excellent support from all-rounder Stuart Thompson -- the second Ireland batsman to make a Test fifty -- in a seventh-wicket stand of 114 that denied Pakistan an innings win in this one-off match.

When Thompson was bowled by leg-spinner Shadab Khan for 53, Ireland were 271 for seven.

Tyrone Kane extended Ireland's lead to three figures and gave them a chance, admittedly an outside one, of becoming just the fourth side in the 141 years of Test history to win a match after following-on.