Hosts West Indies were staring at certain defeat at stumps on the fourth day when they were reduced to 130 for five chasing 427 for victory against Pakistan at Warner Park on Monday.
Brendan Nash (30) and Carlton Baugh (7) were at the crease as the home side lost four wickets in the final session of play after reaching tea at 54 for one.
Pakistan paceman Tanvir Ahmed made an early breakthrough for Pakistan, after Misbah-ul-Haq scored his third career hundred and made sure his side had a superb chance to square the two-match Test series.
Left-arm spinner Abdul Riaz took three wickets for 26 runs in 14 overs. Darren Bravo was the top scorer for West Indies, departing exactly on 50, lbw to Wahab Riaz.
Tanvir bowled West Indies opener Kraigg Brathwaite for a duck in the third over of the innings after a resolute, undefeated 102 from Misbah propelled Pakistan to 377 for six in their second innings. The visitors declared about an hour before tea.
The Pakistan captain struck 10 fours and two sixes from 141 balls in close to five hours, sharing a fifth wicket stand of 129 with Taufeeq Umar, the other century-maker in the innings with 135, and a 62-run, sixth-wicket stand with Umar Akmal, who made 30.
Leg-spinner Devendra Bishoo was the most successful West Indies bowler with two for 149 from 38 overs.
Misbah reached his hundred from 141 balls, with a thick edge to third man for his last boundary.
But Akmal was bowled by Bishoo for 30, and Mohammad Salman was caught at deep fine leg off Ravi Rampaul for eight before the declaration came.
Before lunch, Taufeeq completed his fifth career hundred before gifting his wicket just before the break, leaving Pakistan 320 for four.
Taufeeq was run out, after he and Misbah reinforced the Pakistanis’ superiority, batting untroubled through most of the period before the interval.
Pakistan trail 0-1 in the two-Test series, following a 40-run defeat inside four days in the first Test, which ended last Sunday at the Guyana National Stadium, crushing their dreams of a maiden Test series victory in the Caribbean.