Pakistan's spinners scythed through Australia's top order in the second innings to get them close to victory in the first Test after centuries from Younus Khan and youngster Ajmal Shehzad helped the hosts set an improbable target.
Left-arm spinner Zulfiqar Babar and debutant leg-spinner Yasir Shah took two wickets each as Australia crawled to 59 for four wickets at the close of play, after being set 438 to win.
David Warner (29), who had scored 133 in the first innings, and Alex Doolan (zero) fell in the same over to Babar while Shah took out Australia captain Michael Clarke (three) and nightwatchman Nathan Lyon (zero) - also in one over.
Chris Rogers (23), the other opener, was given out caught behind on 14 against Babar but managed to overturn the decision on referral and remained unbeaten. Steve Smith was the other not out batsman on three.
Younus, who had scored 106 in the first innings, remained unbeaten on 103 in the second for his 26th Test hundred to overtake Inzamam-ul-Haq as the most prolific century-getter by a Pakistan batsman.
He also became the first batsman in 40 years, since New Zealander Glenn Turner in 1974, to hit twin centuries in a Test match against Australia.
Pakistan declared on 286 for two and as soon as former captain Younus crossed his mark, ending the ordeal for Australia's bowlers who looked toothless.