Pakistan won the first Test of the three-game series by seven wickets in Jamaica as they seek to clinch.