Inexperienced spinners Zulfiqar Babar and Yasir Shah shared nine wickets and led Pakistan to an emphatic 221-run victory against Australia on the fifth and final day of the first test on Sunday.
Left-arm spinner Babar, in only his third test, took 5-74 and legspinner Shah grabbed 4-50 in his debut test as Australia, chasing an improbable 438 runs for victory, was bowled out for 216 in the last session.
Mitchell Johnson (61) and Steven Smith (55) delayed the inevitable after being given two chances each before Australia eventually succumbed to Babar and Shah's guile.
It was a remarkable turnaround in Pakistan's performance after it lost the test and one-day series in Sri Lanka, and Australia routed them 3-0 in the ODI series.
"It was a much needed win for us because we didn't do well in our previous series," a relieved Pakistan captain Misbah-ul-Haq said.
"These (Pakistan) bowlers are young at international level but they have lots of experience of first-class cricket, they know how to bowl long spells and put (on) pressure."
The return of Younis Khan lifted Pakistan in the five-day format after he criticized selectors for dropping him from the one-day series.
Younis made 106 and 103 not out and became the first batsman in 40 years to score centuries in each innings against Australia in a test match since Glenn Turner did it in 1974 for New Zealand.
The defeat ended Australia's hopes of regaining the No. 1 spot from South Africa in test rankings as it needed to clinch the series 2-0 against Pakistan.
"They outplayed us in all three facets of the game," Australia captain Michael Clarke said after scoring only 2 and 3 in two innings.
"They batted really well up front ... and then their spinners were able to execute on a wicket which obviously spun a lot more yesterday and today."
Resuming on a precarious 59-4, Chris Rogers (43) and Smith defied Pakistan for more than an hour and took the score to 92 before another newcomer, fast bowler Imran, struck with a full delivery from around the wicket that knocked back Rogers' stumps.
Mitchell Marsh, playing his first test, didn't look at ease against the spinners on a turning wicket before Azhar Ali took a brilliant reflex catch at silly point off Babar.
Haddin also struggled for 10 deliveries and was bowled by Babar off a straight delivery for a duck when he left a big gap between bat and pad as Australia slipped to 117-7 by lunch.
Pakistan spinners bowled with so much authority that Australia's first boundary of the day came when Smith hit Babar through the covers after lunch.
But Smith and Johnson prospered on four chances - all off unlucky Babar - in a 65-run eighth wicket stand before Shah eventually had Smith caught close to the wicket.
Wicketkeeper Sarfraz Ahmed spilled an easy stumping when Smith was on 37 and captain Misbah-ul-Haq dropped a hard chance at short cover before Smith had scored his half century.
Johnson also had lucky escapes in his 20s with Ahmed Shehzad and Shah misjudging catches off sweep shots before the left-hander was finally stumped just after tea after hitting six fours and a six in his 127-ball knock.
Babar deservedly folded the innings by having No. 10 Peter Siddle, who advanced down the wicket in order to defend, but gave Ali his second catch of the innings with a big inside edge.
The second and final test of the series starts in Abu Dhabi on Thursday.