Pakistan recovered from 57-5 to post 282 and take two cheap Australia wickets on a compelling first day of the second cricket Test on Tuesday.
Nathan Lyon took four wickets in six deliveries to embarrass Pakistan in the morning, but newcomer Fakhar Zaman and captain Sarfraz Ahmed led the rescue with identical scores of 94 runs each before both were dismissed by part-time legspinner Marnus Labuschagne.
Seamer Mohammad Abbas then put Pakistan on top at the end of the day by dismissing Usman Khawaja for 3 and nightwatchman Peter Siddle for 4 on the last ball of the day to leave Australia 20-2 in reply. Aaron Finch was 13 not out.
Australia rallied to draw a thrilling first test in Dubai by batting out the last day and surviving with two wickets left.
The visitors started this test in equal fashion with a stunning 11-minute period by offspinner Lyon.
He took a return catch to remove Azhar Ali on 15 and then dismissed Haris Sohail, Asad Shafiq, and Babar Azam all without scoring.
Pakistan was in a reasonable position at 57-1 after winning the toss, but the Australia spinners were threatening.
Then the threat became reality. Lyon took the wickets of Ali and Sohail on consecutive balls to end his fourth over, the 20th of the innings.
Shafiq blocked the hat-trick ball, the first ball of the 22nd over, but got a faint inside edge to Lyon's subsequent delivery and was caught at bat-pad by Labuschagne after a successful decision review by the Australians.
Lyon struck again two balls later for figures of 4.4-4-4-4. In the process, Lyon surpassed former paceman Mitchell Johnson to move to fourth on Australia's list of all-time leading wicket-takers with 314. At tea, he had 4-58.
Pakistan's perilous position could have been worse. Zaman survived being dropped on 30 by Labuschagne off an irked Jon Holland, and later a close run out.
Labuschagne earlier brought off a sensational catch close to the wicket to dismiss opener Mohammad Hafeez for 4 in Mitchell Starc's second over, before Zaman and Ali shared a half-century stand for the second wicket.
After crashing to 57-5 in the first session, Pakistan outsmarted Australia in the second session through Zaman and Ahmed as they scored 127 runs.
Zaman scored nearly three quarters of his runs on the offside, hitting eight fours and a six in his 198-ball knock.
He was six runs from a century on debut when Labuschagne, not given a bowl until just before tea, trapped Zaman leg before wicket on the stroke of tea. It ended a remarkable 147-run, sixth-wicket stand lasting 37 overs.
Ahmed was, by far, more aggressive, and kept the scoreboard moving with constant rotation of the strike before his 129-ball knock was ended in which he hit seven boundaries. He tried an ambitious big hit to raise his hundred but sliced a catch to Siddle and missed out on his first century in four years.
No. 9 batsman Yasir Shah lifted the total with a breezy 28 before Pakistan was all out.
Pakistan made two changes to the lineup that started in Dubai, giving Zaman and left-arm seamer Mir Hamza test debuts as replacements for Imam-ul-Haq and Wahab Riaz.
Hamza bowled one over late in the day, but Abbas got both strikes, getting Khawaja caught behind down the leg side for his 50th test wicket, and trapping Siddle.