The day started with Ireland, playing in their maiden Test, resuming their second innings on 319 for seven with the centurion Kevin O’Brien still at the crease.
O’Brien’s valiant effort ended soon as he was dismissed for 118 runs with the team’s score reading 321.
Ireland were facing an innings defeat when O’Brien came in at 95 for four but, with assistance from Stuart Thompson who made 53, he turned the tide during a seventh-wicket partnership of 114.
The Irish innings folded on 339 runs, setting the visitors a target of 160 runs for a win.
Ireland gave Pakistan an early scare after claiming the first three wickets with just 14 runs on the board.
However, ul-Haq and Babar Azam steadied the innings with patient half centuries that ensured their side's win. Azam made 59 before he was run out while Ul-Haq remained unbeaten on 74.
Tim Murtagh claimed two wickets for Ireland while Stuart Thompson and Boyd Rankin claimed a wicket each for the home side.