Australia hung on for a sensational draw in the first test against Pakistan after opening batsman Usman Khawaja scored a patient century on the last day Thursday.
Starting the fifth day on 136-3 and an improbable 326 more runs from victory, Australia batted for a draw and survived a testing last hour eight wickets down.
1st Test, Day 2: Finch, Khawaja start cautiously after Sohail's maiden Test ton takes Pakistan to 482
1st Test, Day 4: Pakistan need seven wickets to grab 1-0 lead in series as Australia face uphill task
After legspinner, Yasir Shah snared Khawaja, Mitchell Starc, and Peter Siddle within eight balls, Australia captain Tim Paine, 61 not out, and No. 10 batsman Nathan Lyon, 5 not out, held out against every twist and shout by Pakistan.
Australia finished on 362-8, its longest fourth innings for a draw, after 202 in the first innings.
Pakistan scored 482 and 181-6 declared.
"It was an extremely tough test match," Paine said after defying Pakistan for 194 balls and hitting five boundaries. "It doesn't feel like a win. We were outplayed ... but we can play a lot better in the next test.
"I was nervous (in the last hour). That's how it happens here; if batsmen get in, it's easy."
All of Khawaja's 8 1/2-hour toil in which he scored 141 off 302 balls seemed to have gone in vain when Shah claimed him and two other quick wickets to give back Pakistan a big sniff of victory.
But Paine and Lyon thwarted Pakistan over the last 12 overs to pull off a remarkable draw.
Khawaja and Paine seemed to be carrying Australia to safety in their sixth-wicket stand lasting 36 overs.
But just after the left-handed Khawaja made the highest score by any visiting batsman in Asia, passing Daniel Vettori's 140 in 2009 in Colombo, he was out. He missed a sweep shot off Shah's delivery around the wicket and was plumb leg before wicket.
Starc was brilliantly snapped up on 1 close to the wicket by Babar Azam, and Siddle fell lbw for 0 off a sharp Shah delivery.
But Paine and Lyon batted resolutely against Shah (4-114), seamer Mohammad Abbas (3-56), and offspinner Bilal Asif, who took six wickets in the first innings but none in the second.
"We hoped to roll them out but we have to give credit to Khawaja," Pakistan captain Sarfraz Ahmed said.
"We had an idea that he would understand our tactics, but it wasn't easy to bat, and despite that, he soldiered on. We could have won this, but tests are like this. We're sad, but the opposition also played well and we need to acknowledge that."
Earlier, Pakistan had to wait until after lunch to make the day's first breakthrough when Mohammad Hafeez had Travis Head (72) lbw off the very first ball with the second new ball.
This ended a brilliant 132-run, fourth-wicket stand as Head dug in on a wearing pitch in his debut test. He hit five fours in his 175-ball knock for his maiden half-century.
Khawaja reached his first century in Asia off 224 balls with 10 fours.
Then Shah claimed his first wicket of the match by snaring Marnus Labuschagne (13) lbw off a quicker leg-break.
Pakistan came close to dismissing Khawaja on 109, but Azhar Ali's throw from long off missed the stumps at the non-striker's end with the batsman way out of his crease.
Khawaja and Head added 79 runs together in the first session, and Khawaja led them in gathering 74 more in the second session. Khawaja departed an hour into the last session, but he'd given his teammates a blueprint on how to defend.
The second test starts on Tuesday.