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.
Australia then stretched its lead to 505 before declaring its second innings at 97-2, but its bowlers couldn't rattle the confidence of Babar, who batted almost five sessions and denied the visitors from taking a 1-0 lead in the three-match series.
Babar stayed firm and blunted the reverse swing of experienced fast bowlers Pat Cummins (2-75) and Starc (0-58), while also negating the spin threat of Lyon and Swepson for most of the last day.
Australia had its chances to dismiss Babar but Travis Head and Marnus Labuschagne dropped two sharp catches close to the wicket off Swepson's successive deliveries before tea just after the Pakistan skipper had surpassed his previous test best of 143 made against Bangladesh in Rawalpindi in 2020.
Cummins got both wickets on either side of the first two sessions after Pakistan resumed on 192-2 with Babar resuming on 102 and Shafique on 71.
Shafique grinded out Australia's bowlers for almost eight hours.
When it looked like Pakistan will go unscathed at lunch, Cummins got the breakthrough in the penultimate over.
Shafique, who hit his maiden test century in the drawn first test in Rawalpindi, gave a healthy edge to Smith at first slip, who had dropped a sitter when Shafique was on 20 on Day 4.
Babar continued to dominate both pace and spin and also survived the short pacey spells of Starc and Cummins, who couldn't get enough swing to trouble the batters with the second new ball just two overs old when the day began.
The third and final test begins in Lahore on Monday with Australia's first test series in Pakistan since 1998 still tied 0-0.
(Reported by AP)