Mohammad Abbas struck three times in the space of seven balls to leave Australia with an uphill task of saving the first Test against Pakistan in Dubai.
Australia went to stumps on the fourth day on 136/3, still requiring another 326 to get to their 462-run target, with opener Usman Khawaja (50 not out) and Travis Head (34 not out) at the crease.
Just as they did in the first innings when they were bowled out for 202, the tourists’ opening pair of Khawaja and Aaron Finch gave them a great start with the bat.
The duo took their partnership to 87 when seamer Abbas trapped Finch lbw on 49.
The batsman reviewed the decision but it was upheld and the Aussies were one down.
Shaun Marsh only lasted just two balls before Abbas had the left-hander nicking off to wicketkeeper Sarfraz Ahmed.
After Khawaja played out a maiden from Wahab Riaz at the other end, Abbas needed just four balls to trap Mitchell Marsh (0) in front.
It was originally given not out but Sarfraz successfully reviewed as the Aussies lost three wickets for the addition of no runs with Abbas ending the day with figures of 3-26 to go with his four scalps in the first innings.
At that stage the touring team would have had nightmares from day three when they lost all ten of the wickets for just 60 runs after getting a 142-run start from the openers.
Khawaja and Head though saw Australia safely through to the close with the latter scoring his first runs in Test cricket after getting a duck in the first knock.
The partnership is currently on 49 but Pakistan know they only need one wicket to trigger a collapse on the fifth day and go 1-0 up in the two-match series.
Earlier, Pakistan batted until well into the second session of the day before declaring on 181/6.
Resuming on 45/3, left-arm spinner Jon Holland (3-83) took the scalp of Imam-ul-Haq (48) to add to his two wickets from late Tuesday evening.
Nathan Lyon (2-58) took the other two wickets to fall while Asad Shafiq (41), Haris Sohail (39) and Babar Azam (28 not out) were the other main contributors with the bat as Pakistan gave the Aussies 462 runs to win.