Pakistan captain Babar Azam hit a career-best 196 before the tailenders hung in to escape with a draw in the second Test against Australia on Wednesday.
Veteran off-spinner Nathan Lyon grabbed three late wickets to finish with 4-112 but Pakistan vice captain Mohammad Rizwan thwarted Australia with an unbeaten 104 off 177 balls to guide Pakistan to 443-7 in a sensational last hour on the final day.
No 9 batter Nauman Ali successfully defended 18 balls without scoring and saw off the last eight overs with Rizwan after Pakistan had slipped to 414-7.
With 13 overs left in the game, Lyon made inroads into Pakistan's lower order when Babar gloved a catch close to the wicket after defying Australia with his knock off 425 balls over 10 hours.
Left-hander allrounder Faheem Ashraf edged a low catch in the slip off Lyon's next delivery and Sajid Khan also offered a tame catch to Smith before Rizwan and Nauman batted patiently.
Debutant legspinner Mitchell Swepson (0-156) had provided Australia with another chance with 19 balls left in the game, but Usman Khawaja dropped a low catch off Rizwan at short extra cover.
Rizwan raised his deserved century by hitting Lyon for two boundaries on either side of the wicket in the penultimate over before running a single to reach the three-figure mark.
Babar's marathon effort, during which he hit 21 fours and a straight six, was the highest ever by any captain in the fourth innings of a test match and surpassed Michael Atherton's 185 not out against South Africa in Johannesburg in 1995. Babar shared two solid stands on the last day, adding 228 runs with Abdullah Shafique (96) and then, after losing Fawad Alam in the second session, batting with Rizwan to add further 115 runs.
It was a remarkable escape by Pakistan at the fortress of its Test venues - the National Stadium - when it was out for 148 in the first innings on the third day against the reverse swing of Mitchell Starc and conceded a massive 408-run lead.