Fakhar Zaman and Sarfraz Ahmed came to Pakistan's rescue after a blistering spell of Nathan Lyon bowling had handed Australia early control of the second Test on day one in Abu Dhabi.
Pakistan were reeling on 57-5 part way through the morning session, their top order decimated by Lyon (4-78) in the space of six deliveries as he took four wickets for no runs.
That devastating burst took the him up to fourth in his country's all-time Test wickets list, above Mitchell Johnson, but his side's momentum was soon slowed.
Opener Zaman (94) and captain Sarfraz (94) combined for a sixth-wicket stand of 147, carrying Pakistan towards their total of 282 all out, although the wickets fell with some regularity again following that effective partnership.
The efforts of the batsmen were rewarded as Australia made a poor start of their own at the crease, Mohammad Abbas (2-9) taking two early wickets to leave Tim Paine's side on 20-2, trailing by 262.
An unorthodox early Marnus Labuschagne catch accounted for Mohammad Hafeez (4), but Pakistan were progressing steadily before Lyon intervened with an astonishing flurry.
The spinner first caught and bowled Azhar Ali (15) and then tempted Haris Sohail to jab at Travis Head from the following delivery, ending the 20th over on a hat-trick.
Lyon fell short of the treble, but his next over – following Jon Holland's maiden – was just as rewarding, with Labuschagne catching from Asad Shafiq before Babar Azam's stumps were ripped out.
Test debutant Fakhar managed to stand firm, however, and he and Sarfraz gradually turned the tide, plundering boundaries before the end of the first session and then ploughing on towards tea.
Australia looked to be in trouble as the duo raced towards centuries, losing both reviews in a desperate attempt to undo Pakistan, but Labuschagne (3-45) made his lbw breakthrough to stop Fakhar six runs short of a ton.
Sarfraz returned after tea but new partner Bilal Asif (12) did not survive long before edging to Tim Paine, with the skipper finally following as he sliced a tired shot to cover.
The big-hitting Yasir Shah (28) had his leg stump removed by Mitchell Marsh and the innings ended with Mitchell Starc rattling through Abbas (10).
But Abbas ensured Pakistan ended the day on top as he took out Usman Khawaja (3) and Peter Siddle (4), checking Australia's hopes of a straightforward follow-up to the epic draw of the first Test.
|Colts owner Jim Irsay buys John Lennon´s ´Sgt. Pepper´ piano|
|People are having a free shot - Seibold defends young Broncos|
|Zidane must make Real Madrid hungry again - Seedorf|
|Young dropped as Solskjaer makes three changes for Everton clash|
|Lemar hopeful Griezmann stays at Atletico|
|Khan refutes Crawford´s accusations of quitting after low blow|
|Deciding doubles triumph sends Australia into Fed Cup final|
|Pakistan call up Yasir with Shadab laid low by virus|
|Wellington Phoenix 3 Melbourne City 2: Krishna´s last-gasp hat-trick boosts top-four hopes|
|Oh, for real? I didn´t know! - Harden unaware of early shooting woes|
|Solskjaer warns Alexis Sanchez Man Utd won´t carry players|
|Dele Alli thinks Tottenham´s Champions League run has Russian roots|
|Leilua brace downs Broncos as Raiders keep pace at NRL summit|
|Spalletti hails Inter´s Roma draw as ´precious´|
|Stuttgart had to make Weinzierl decision - Hitzlsperger|
|Tucker´s homer on MLB debut powers Pirates to fifth straight win|
|76ers win thriller, Rockets overcome Harden struggles to move 3-0 ahead|
|Crawford retains title by TKO after low blow stops Khan|
|MLS Review: De Boer´s Atlanta woes continue, Nani lifts Orlando|
|Garcia beats Granados via seventh-round TKO|
|Muller: Bayern feeling title pressure|
|He parks the bus right in front of De Gea – Van Gaal critical of Solskjaer again|
|Red Sox star Eovaldi on injured list with elbow issue|
|We real cool – Lillard plays down Westbrook feud|
|Embiid trolls Warriors after 76ers take 3-1 lead over Nets|
|Allegri dismisses criticism after Scudetto success|
|Solskjaer warns of no quick-fix for Man United in transfer market|
|Klopp a hermit amid Liverpool title hype|
|Dudley is ´a nobody´ – 76ers star Embiid|
|Johnson leads RBC Heritage heading into final round|
|Pogba can´t always have things his own way, says Solskjaer|
|Whyte to face unbeaten Rivas in July|
|Clermont hold off Harlequins to reach Challenge Cup final|
|Barcelona have to suffer to win – Valverde|
|Allegri staying at Juventus and targeting improvement|
|Man United win made Sociedad tough, says Barca´s Jordi Alba|
|Nadal: I probably played one of the worst matches on clay in 14 years|
|Sarri: Chelsea´s League Cup run on par with Tottenham´s heroics|
|Barcelona 2 Real Sociedad 1: Lenglet and Alba bring title closer|
|Inter 1 Roma 1: Perisic answers El Shaarawy stunner|
|La Rochelle edge past Sale to book Challenge Cup final berth|
|Capitals enjoy home comforts again to reign over Kings XI|
|Ronaldo proud of first Serie A season as Juventus celebrate title triumph|
|Ronaldo confirms Juventus stay after Serie A success|
|He´s showing great commitment - Gracia hails match-winner Deulofeu|
|Parker and Fulham ´discussing plans´ for next season|
|Juventus 2018-19: Ronaldo´s goals key to eighth successive Scudetto|
|I´m thankful that I´m playing for them - Vunipola grateful for support at Saracens|
|Newcastle United 3 Southampton 1: Perez hat-trick all but seals safety|
|Juventus 2018-19: Bianconeri join Europe´s fastest title triumphs|
|That point could make the difference - Ryan salutes resolute Brighton|
|Atletico Madrid defender Gimenez dislocates toe in Eibar win|
|Kovac: Patience key to crucial Bayern victory|
|Juventus 2018-19: How the Old Lady won an eighth straight Serie A title|
|Juventus 2018-19: The AC Milan team last to rule before the Bianconeri´s dominance|
|Juventus 2 Fiorentina 1: Bianconeri bounce back to seal Scudetto|
|Juventus seal eighth successive Serie A title|
|Pellegrini blames officials for more dropped West Ham points|
|Valencia appears to confirm Manchester United exit in Instagram post|
|Brumbies hold firm to see off Stormers|
|Halep on form but France draw level in Fed Cup semi|
|Pochettino refuses to criticise officials after missing out on penalty|
|Farrell guides Saracens into Champions Cup final|
|Eibar 0 Atletico Madrid 1: Lemar strikes late at Ipurua|
|Fabulous Fognini ends Nadal´s Monte Carlo winning streak|
|Bournemouth 0 Fulham 1: Mitrovic on target as Parker´s men win again|
|West Ham 2 Leicester City 2: Last-gasp Barnes strike grabs dramatic draw|
|Huddersfield Town 1 Watford 2: Deulofeu double lifts Watford into seventh|
|Wolves 0 Brighton and Hove Albion 0: Hughton´s men stop rot with stalemate|
|Now I am a genius – Guardiola applauds match-winner Foden|