Usman Khawaja made a magnificent resilient hundred before Tim Paine and Nathan Lyon denied Pakistan as Australia produced a monumental rearguard action to draw the first Test in Dubai.
Pakistan needed seven wickets on the final day to go 1-0 up in the two-match series after Australia resumed on 136-3, needing a highly unlikely 462 to win, but Khawaja (141) and Travis Head (72) frustrated them with a fourth-wicket stand of 132.
Khawaja made the highest scoring in the fourth innings of a Test in the United Arab Emirates, spending 524 minutes at the crease - taking him to 767 in total - in a heroic 302-ball knock, but the tourists looked to be heading for defeat when Yasir Shah took three late wickets.
Pakistan had 12.2 overs to claim the two wickets they needed for victory after Yasir (4-114) removed Khawaja, Mitchell Starc and Peter Siddle in quick succession, but Paine (61 not out) and Lyon (5no) dug in under pressure to complete a great escape, Australia closing on 362/8.
Australia collapsed with a whimper in the first innings, but Islamabad-born opener Khawaja - who top scored with 85 in the first innings - batted with remarkable application and skill as he and Head ensured no wickets fell in the morning session.
Pakistan struck twice before tea and although Yasir produced a huge twist late in the day, Paine faced 194 balls in a brilliant captain's knock and Lyon also showed great character to rescue Australia.
Head fell without scoring in his first Test innings but made amends by offering great support for Khawaja, who continued to take a positive approach against the spinners.
Khawaja played with great authority and Head reached his half-century after Pakistan opted against reviewing when he was struck on the pad, replays showing he would have been on his way.
Pakistan felt aggrieved when Khawaja was still there after a sharply turning delivery from Haris Sohail rapped him on the pad, the ball hitting the opener just outside the line of off stump, and Australia moved on to 215-3 at lunch.
Mohammad Hafeez got the elusive breakthrough just after the break, trapping Head bang in front from the first delivery with the new ball to end a gritty 175-ball knock.
Khawaja twice lofted Hafeez down the ground for boundaries which moved him into the 90s and the left hander punched the air as he jumped for joy after a quick single took him to three figures for the sixth time in the longest format.
Marnus Labuschagne danced down the wicket to launch Hafeez for six over mid-off, but paid the price for going back to a quicker leg break from Yasir, who pinned the all-rounder in front of middle stump.
Paine walked to the middle with Australia 252-5 and got his eye in after a shaky start, Khawaja still going strong and looking fresh as they saw it through to tea - Pakistan opener Imam-ul-Haq off the field with his finger in a brace.
Pakistan were out of reviews when Sarfraz Ahmed called for a review for lbw, Paine getting an inside edge on an off break from Bilal Asif, but Yasir ended a 79-run stand by snaring the magnificent Khawaja leg before.
It appeared that Khawaja's tour de force would be in vain as Babar Azam took a brilliant catch at short leg to see the back of Starc and Siddle also fell to Yasir without scoring in the same over.
Lyon and Paine stayed cool under pressure in the heat, though, surviving a few close calls to prevent what looked certain to be a Pakistan win.
|Rondo, Ingram and Paul exchange punches in Lakers-Rockets clash|
|Dodgers to face Red Sox in World Series after beating Brewers|
|Valverde doesn´t care about extending Barca contract|
|Qualifying speed a ´positive surprise´ for Ferrari´s Vettel|
|I was in a different headspace – Hamilton revels in Austin pole|
|Barcelona can cope without Messi – Pique|
|Allegri: Juventus abandoned Genoa clash|
|Sale: Hospital visit was because of belly button ring|
|Valverde accepts Barcelona will miss Messi|
|No Messi or Ronaldo in El Clasico for first time since 2007|
|Barcelona have not won a Clasico without Messi since his debut|
|Ramos calls for Real Madrid unity after latest loss piles pressure on Lopetegui|
|Hamilton has title in sights after storming to Austin pole|
|Inter, El Clasico and more - the games Messi will miss with broken arm|
|End of Messi-Ronaldo duel good for LaLiga - Simeone|
|Messi out of Clasico with fractured arm|
|Awesome Ashton marks Sale bow with hat-trick|
|Klopp hopes for positive Henderson prognosis amid Liverpool injury issues|
|Benitez ´convinced´ Newcastle can survive despite seventh defeat|
|Barcelona 4 Sevilla 2: Messi injured but champions go top|
|Kovac relieved by Bayern´s timely victory|
|Strasbourg 2 Monaco 1: Sy howler and Grandsir red card cost Henry in first match|
|Leicester City defender Chilwell signs new six-year contract|
|PSG´s Tuchel hopes Verratti and Di Maria can face Napoli|
|Liverpool star Salah had no fear during scoring drought|
|Alonso´s 2019 plans not damaged by McLaren´s IndyCar decision|
|Edinburgh outclass troubled Toulon, Wasps and Bath play out thrilling draw|
|Barca concern as Messi substituted with worrying arm injury|
|Howe: South coast derby draw a fair result|
|Our heads were in Manchester – Allegri left fuming at Juventus´ loss of focus|
|Derby County 2 Sheffield United 1: Marriott blunts Blades with 77th-minute winner|
|We have so many problems – Jokanovic alarmed by Fulham defensive woes|
|Huddersfield Town 0 Liverpool 1: Salah snaps winless streak|
|Pellegrini ruing injuries after Yarmolenko hurts ankle|
|Villarreal 1 Atletico Madrid 1: Simeone´s side denied LaLiga top spot|
|Gracia: Not easy to dominate Wolves like that|
|Isner´s Finals hopes hindered by Stockholm defeat|
|Dyche incredulous at refereeing decisions in Man City thrashing|
|Juventus 1 Genoa 1: Champions´ winning run ends despite record Ronaldo goal|
|´Fantastic´ Lamela urged to find consistency by Pochettino|
|You don´t want to lose any players - Young speaks out on Wade NFL speculation|
|Championship Review: Smith gets off to a winning start, Leeds beaten|
|Guardiola hails extraordinary Fernandinho after Burnley drubbing|
|Pochettino lauds Lloris as one of world´s best after West Ham heroics|
|Paris Saint-Germain 5 Amiens 0: Ten wins in a row for PSG as Neymar rests|
|Cristiano Ronaldo nets record 400th league goal|
|Marcelo backing beleaguered Lopetegui despite Madrid slump|
|Garcia dazzles to hit the front at shortened Valderrama Masters|
|Cardiff City 4 Fulham 2: Paterson gets Bluebirds off the mark|
|Newcastle United 0 Brighton and Hove Albion 1: Benitez´s men bottom after dismal defeat|
|West Ham 0 Tottenham 1: In-form Lamela settles London derby|
|Manchester City 5 Burnley 0: De Bruyne returns in comfortable win|
|Wolves 0 Watford 2: Capoue and Pereyra turn form book on its head|
|Bournemouth 0 Southampton 0: Howe´s side stifled by Saints|
|Prove you´re crazy about Inter - Spalletti rallies players ahead of Milan derby|
|Wolfsburg 1 Bayern Munich 3: Lewandowski leads Kovac out of trouble|
|Goerges betters Bencic to clinch Luxembourg title|
|Morgan wants more from ´rusty´ England despite series win|
|Sarri says sorry after touchline bust-up overshadows Chelsea´s late escape|
|Chelsea draw an ´awful´ result for excellent United, says Mourinho|
|The Chelsea assistant that angered Mourinho - Who is Marco Ianni?|
|Steve Kerr supports Colin Kaepernick: ´I think he deserves a chance to play´|
|Lopetegui ´more motivated than ever´ amid Real Madrid sack reports|
|That´s football – Rudiger shrugs off late Ianni-Mourinho fracas|
|AC Milan´s improved mentality could be difference against Inter - Gattuso|
|Emotional Kasatkina comes back from the brink to win Kremlin Cup|
|Forget it, it´s over - Mourinho accepts apology over touchline row|
|Mourinho in furious bust-up with Chelsea staff after late equaliser|
|Chelsea 2 Manchester United 2: Barkley strike denies Mourinho|
|Raptors star Kawhi Leonard: Too early for MVP chants|