West Indies leg-spinner Devendra Bishoo took a career best 8-49 and his Pakistani rival Yasir Shah completed 100 wickets on Sunday as the first Test was left poised for an exciting finish in Dubai.
Bishoo's stunning performance limited Pakistan to a paltry 123 in their second innings before West Indies – set a daunting 346 to win the day-night Test – finished the fourth day on 2-95.
West Indies will need another 251 runs for an improbable win while Pakistan's hopes rest on Shah to take a 1-0 lead in the three-match series.
Earlier it was Pakistani leg-spinner Shah who became the joint second-fastest bowler to take 100 wickets in Test cricket during his 5-121 which bundled West Indies out for 357 in their first innings.
Pakistan, who scored 3-579 declared in their first innings, did not enforce the follow-on despite West Indies coming up 23 runs short of their target of 380.
West Indies, who hold the record for the highest run-chase in all Test cricket with their 7-418 against Australia at Antigua in 2003, kept Shah at bay with Leon Johnson (47) and Darren Bravo (26 not out) adding 60 for the second wicket.
West Indies lost opener Kraigg Brathwaite for six when he was bowled by fast bowler Mohammad Amir, who also dismissed Johnson leg-before.
Marlon Samuels was the other not out batsman on four on a day when wickets fell like nine pins.
Bishoo said he was delighted at his feat.
"I tried my plan and it worked," said Bishoo, who also finished with 10-158 – his first ten wicket haul in his 19th Test.
"I am delighted to get 8-49 which is a great feeling and I don't have words to describe it -- (I'm) more happy for our position because we think we have a very good chance of winning."
It was a remarkable turnaround on the Dubai stadium pitch as 16 wickets fell on day four alone, after just nine fell on the first three combined.
With the rough marks on the pitch helping spinners, Bishoo triggered a middle-order collapse after Pakistan had lost opener Azhar Ali (two) and Asad Shafiq (five) just before tea.
Bishoo, who had trapped Shafiq leg-before, then came into his own, dismissing Babar Azam (21), Sami Aslam (44), Misbah-ul-Haq (15), Mohammad Nawaz (nought) and Wahab Riaz (five) in the space of 40 balls for 21 runs.
He then needed five balls after tea to remove Sarfraz Ahmed, stumped for 15, and bowled Amir for one to record the fifth best bowling figures in an innings for West Indies in Test cricket.
Bishoo's previous best bowling was 6-80 against Australia at Dominica last year.
Ali, who scored a career best 302 in the first innings, was lucky to avoid a caught behind decision off Gabriel but was trapped leg-before the very next ball.
The day also belonged to Shah who wrapped up the West Indies innings in quick time and also reached a milestone.
England's right-arm medium-pacer George Lohmann reached 100 Test wickets in just 16 Test matches in 1896, which still is a world record in Test cricket's 140-year history.
Australia's Charlie Turner and Clarrie Grimmett, and England's Sydney Barnes each got to the milestone in their 17th Test.
Shah, who made his debut at the same venue in October 2014, bettered off-spinner Saeed Ajmal who held the Pakistani record of fastest to 100 Tests wickets in 19 matches.
West Indies' overnight batsmen Shane Dorwich (32) and Jason Holder (20) both fell to Shah while Bishoo (17) fell to Nawaz as West Indies failed to delay the inevitable.
Nawaz finished with 2-30 on his debut and Riaz took 2-65.
The remaining two Tests will be played in Abu Dhabi (October 21-25) and Sharjah (October 30-November 3).