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.
|Klopp calls for electric Anfield atmosphere against Napoli|
|Saints clinch back-to-back NFC South titles, Bears trump Rams|
|Bucks improve to 2-0 against Raptors with win in Toronto|
|Black Caps include Patel for Sri Lanka Tests|
|Maidana: River want Real Madrid clash|
|Cowboys top Eagles in OT behind stellar Cooper display|
|AC Milan evaluating Fabregas signing – Leonardo|
|WATCH: Steelers´ chance at game-tying field goal slips away|
|Hayne will plead not guilty to charges, says lawyer|
|Boca boss Schelotto: The only thing I feel is sadness|
|Cardinals´ Fitzgerald makes NFL history with most receptions for one team|
|River Plate´s Copa Libertadores star Gonzalo Martinez confirms January departure|
|Klopp: I was never worried about Salah´s form|
|Packers QB Rodgers sets NFL record for most passes without an interception|
|World Cup bulking hampered Man United form – Lukaku|
|Leonardo rules out Ibrahimovic Milan return|
|Warriors´ Green to return against Timberwolves|
|I feel for him… we´ll make it work – Butler responds to Embiid´s frustration|
|Torino draw no missed opportunity for misfiring AC Milan, claims Gattuso|
|We´ll always be linked together forever - Wade reflects on playing with James before final match-up|
|O´Sullivan wins record seventh UK title|
|Chiefs secure playoff berth, Saints win NFC South|
|River Plate 3 Boca Juniors 1 (aet, 5-3 agg): Quintero and Martinez clinch Libertadores title in extr|
|WATCH: Chiefs QB Mahomes throws no-look pass|
|Dolphins defeat Patriots on miraculous final play|
|Kizzire eagle snatches QBE Shootout victory|
|AC Milan 0 Torino 0: Donnarumma shines, Cutrone misses late chance|
|Back to the drawing board for West Indies - Chase|
|Copa Libertadores: Messi and Griezmann among stars in Madrid for River-Boca Superclasico|
|Brady sets NFL record for most career TD passes|
|Copa Libertadores: Tevez named on Boca bench for Superclasico final|
|Premier League needs VAR, right now! - Benitez fumes over Dean´s decisions|
|McCall expects Itoje to fit for the Six Nations|
|Solari salutes Real Madrid character after ´ugly´ Huesca win|
|Berbatov defends under-fire Lukaku|
|Sarries crush Blues to maintain unbeaten start|
|Newcastle United 1 Wolves 2: Doherty punishes Yedlin red with late winner|
|Deeney jokes he´ll ´smash´ former Watford star Richarlison|
|Huesca 0 Real Madrid 1: Bale ends drought as Solari´s men edge to victory|
|Ponting: Umpires not looking at no-balls|
|Bale ends longest LaLiga goal drought|
|Porter backs Brees for MVP, Saints for Super Bowl|
|Verstappen eyeing 2019 title fight|
|Wall ´shouldn´t have played´ against Cavaliers after scoring just one point|
|Hazard: Man City the best team in the Premier League despite Chelsea win|
|LeBron explains why he gave a Grizzlies employee his game-worn shoes|
|Bangladesh cruise to ODI victory as seamers punish Windies|
|Football will win over violence, claims CONMEBOL president|
|Alcorcon support Reus Deportiu over unpaid players|
|Saponara explains cheeky celebration after last-gasp leveller|
|Godin and Filipe Luis return to Atletico training|
|Kick It Out condemns alleged racist abuse of Sterling|
|Emotional Oosthuizen clinches South African Open title|
|The Sunday Seven - 7 Key Opta facts for NFL Week 14|
|Martino salutes Atlanta´s grand plan|
|India´s tail must show greater application - Bangar|
|Mourinho: Diogo Dalot can be new Gary Neville|
|Sterling hits out at media coverage of black players|
|Lyon roars with defiance as Australia aim for unlikely victory|
|Bulls coach Boylen: Hooked starters ´embarrassing´ in record loss|
|Martinez pays tribute to Martino, Almiron after MLS Cup glory|
|LeBron: Final Wade matchup will be bittersweet|
|Alvarez-Kovalev rematch set for February 2|
|Newcastle Jets 2 Brisbane Roar 0: Sheppard, Jair score first A-League goals|
|India close in on victory in first Test|
|LeBron flirts with triple-double as Lakers down Grizzlies|
|Lomachenko unifies WBO, WBA titles with win over Pedraza|
|Joshua wants Wilder and Fury fights – Hearn|
|Mavericks rookie Doncic leads impressive fourth-quarter surge to beat Rockets|
|Martinez named MLS Cup MVP|