Pakistan has batted out almost two full days on a crumbling Karachi pitch to hang on for a draw in the second Test against Australia.
The hosts looked consigned to defeat at numerous points over the final three days of the Test, but stunning batting from Babar Azam (196) and Mohammad Rizwan (104*) got them over the line.
Australia will be left to rue missed chances on days four and five, with a number of catches going down at crucial stages, as they failed to take the 10 wickets required for victory once again.
Two-and-a-half months after a demoralised England batted out day five to rescue a draw at the SCG, Australia's bowlers in Karachi had just shy of six full sessions to bowl Pakistan out in the second Test.
Pat Cummins and his bowling cartel would have been confident of doing so after skittling Pakistan for 148 in the first innings with reverse swing on day three, opting not to enforce the follow-on available to them thanks to Australia's first-innings 9-556.
Instead the Aussies added 97 more runs with the bat to build a 505-run lead before declaring half an hour into day four, setting Pakistan a seemingly impossible feat — make it through two full days, or score a record-breaking 506 runs to win on a wearing pitch.
After Abdullah Shafique (96) and Babar got the team to day five in a position of relative strength, just two wickets down, they continued to blunt the attack, scoring regularly enough to spark whispers of a potential run chase later in the day.
But Abdullah, playing just his fourth Test, fell brutally short of a second Test ton just before lunch on day five when he edged his 305th ball through to Steve Smith, who this time pouched a chance remarkably similar to one he dropped when the opener was on just 20 on day four.
Unorthodox left-hander Fawad Alam also nicked off to Cummins shortly after lunch, uniting Babar and Rizwan, who spent 41 overs together for their 115 runs, taking the game into the final session with Australia still needing six wickets to win.
Along the way, both survived close LBW reviews that narrowly upheld on-field 'not out' calls, and Babar was dropped twice in two balls off Mitch Swepson just before tea, although both were tough chances at silly mid-off and short leg.
They seemed so assured at the crease that even 196 runs to win in the final session did not seem beyond them, but they instead took the game deep, playing for the draw.
Just when it seemed they would carry the team over the line, Nathan Lyon, bowling his 50th over with just under an hour left in the Test, got a ball to spin and bounce, finding Babar's edge and Marnus Labuschagne's hands at short leg.
Lyon had Faheem Ashraf caught behind the next ball, and suddenly the Aussies were back on top.
Lyon also got a counter-attacking Sajid Khan for 9 to finish with 4-112, but Rizwan, with a perfect combination of aggression and grit, made his way to his second Test century and got his team over the line for a famous draw.
The series remains 0-0 heading into the third Test in Lahore, which starts on Monday.
Look back at how the day's play unfolded in our live blog.
By Jon Healy
It's a draw! Unbelievable performance by Pakistan
I can't believe Pakistan have done that.
I'm so glad Mohammad Rizwan reached three figures, because that innings definitely deserved a century. And we won't forget that Babar Azam 196 any time soon. Let's not forget Abdullah Shafique's 305-ball 96 either.
Every other Pakistan batter was in single digits, although Nauman Ali can hold his head high with that sweet red ink after surviving 18 deliveries.
For as good as Pakistan was, Australia needs to do some soul searching. Not that they played badly, but this pattern of struggling so mightily to bowl teams out on days four and five is worrying. This pitch was breaking up and doing enough to ask questions and they just couldn't muster the wickets required.
A lot of talk will go back to the decision no to enforce the follow-on, but honestly, Pat Cummins gave the team two whole days (less half an hour) to take 10 wickets on a pitch that looked like so much peanut brittle hurled to the floor, there was that many cracks in it. It should be doable, but Australia is consistently struggling when teams knuckle down.
Questions to ask before Lahore in five days' time, but honestly, what a pleasure to watch that Test match. Especially after the disappointment of the Rawalpindi "contest".
We'll be back with a fresh blog next week, so please join us then, and hang around at ABC Sport for all the wash-up from this affair.
That will do it for me. From Dean and myself, thanks for hanging out. Bye!
By Jon Healy
1 over left - Mohammad Rizwan on strike. Mitchell Swepson will bowl the last over on debut.
May only bowl four balls in fact.
Rizwan sweeps. Five left.
Rizwan defends. Four left.
Rizwan defends. Three left. It'll take a hat-trick.
Rizwan clips a four through the leg side, and the teams shake hands! What an effort from Pakistan to draw this Test.
By Jon Healy
2 overs left - Patrick, where you at?
Lyon takes the penultimate over.
Fielders all around the bat. Stretched shadows cast across the pitch.
FOUR. Rizwan moves to 95 with a cover drive off a half volley in the rough.
Rizwan moves to 99 with four more down the ground.
He probably has two balls to get the ton, because if Nauman is on strike to start next over, I don't think he'll be risking hunting for a single.
OH NO! He charged, chipped, the ball bounced just short of Lyon, who gathered and threw down the stumps at the striker's end. Rizwan juuuuuuuust got back in time. So nervy. He's shaking the dust out of his gloves.
CENTURY FOR RIZWAN!
He gets a leading edge and scurries through to reach 100, and he's retained the strike to boot!
By Jon Healy
3 overs left - Marnus Labuschagne replaces Nathan Lyon
Really? His name definitely came up in the conversation between Smith and Cummins, with Khawaja chiming in.
Geez, if Marnus gets one here he'll be insufferable.
Past the outside edge! Smith convinces Cummins to review. It was really only Smith who thought there was an edge. Didn't look or sound like an edge on telly. Australia burns a review, I think they still have a few left.
Not out. Two reviews left. Side note, excellent first two balls from Marnus.
Big turner and bouncer out of the rough for four byes. So Nauman Ali stays on strike.
Nauman makes it through a really solid over from Labuschagne.
By Jon Healy
4 overs left - Does Cummins bowl himself?
Swepson again. He's down leg to start. First two balls way down leg.
Then a full toss clipped away for two. Rizwan moves to 89. I'm sure he doesn't care about the ton, but also, a "match-saving century" sounds better than a "match-saving 92".
Four balls bowled. No threat to Rizwan.
Smith and Cummins having a long chat. Not sure what about, but hopefully telling him to bowl himself.
Rizwan sweeps hard into short leg, it pops way up in the air, but falls safely. And he gets back for two. Interesting. Why not take the single and give Nauman just one ball to face.
DROPPED! Usman Khawaja has dropped a soda at short mid-off. Rizwan popped the ball straight into his mitts and he just couldn't close them in time. Oh no. Swepson gives his Queensland skipper a pat on the back, but I doubt it helps either of them feel better.
By Jon Healy
5 overs left - Lyon to Nauman Ali
One ball kept out.
Two, three, four negotiated.
One more to go. He's looking good against Lyon, although that one threatened to go past the inside edge.
Over bowled.
By Jon Healy
If GOAT gets 5 for here and Austrakia win then man of the match.
If it's a draw then man of the match Babar Azam-PNG Pete
Babar Azam should be player of the match regardless.
By Jon Healy
6 overs left - Swepson to Rizwan
SIX! Full toss top edged over the deep backward square leg rope. No deep fielders, so pretty safe.
He moves to 87 and settles back into defence.
Bat, pad, stifled shout, anguished punch of the air from Swepson.
A ball stays low and Rizwan can't find the single. And he can't find it off the last either.
By Jon Healy
7 overs left - Lyon to the left-handed Nauman Ali
He's defending well outside off to start.
He looks great in defence. Keeping it off his stumps too.
They go up for LBW, but it's waved away. Too high, maybe spinning too much too.
The crowd gathers round for the last ball of the over...
...and Nauman keeps it out.
By Jon Healy
8 overs left - Mitch Swepson will bowl
Lyon's run off the field for what I assume and hope is just a trip to the toot.
I reckon Rizwan will try to get to his ton here. He's on 79.
Bunted back to Swepson.
Rizwan cracks two runs through cover.
Swepson almost slides one past the inside edge.
OK. Four balls bowled. Field has to come up to save a single. I mean, why were they ever back?
Popped up ... but it's safe! The ball spun sharply away from Rizwan and he almost chipped it straight to catching cover, but just short.
And Swepson saves the single off his last ball to give Lyon a look at Nauman.
By Jon Healy
LYON GETS SAJID KHAN! He's got four!
He played back and edged to slip, where Smith bobbled and gathered.
Three wickets required, but Nauman Ali can bat. As I said in the first innings, he has a Test 97. He averages 29. This isn't a foregone conclusion.
Cardiff, Sydney, Adelaide ... it's not unheard of for tail-enders to survive.
By Jon Healy
9 overs left - Lyon to continue
Sajid Khan on strike.
SLOG SWEEP! Crikey. What a shot from the tail-ender. Good way to avoid the close fielders. Even if he gets an edge, it'll take some catching.
Four more! This time past mid-off.
Just a heads up, they need 11 an over to win. Just sayin'.
By Jon Healy
10 overs left - Pat Cummins does give himself the ball in place of Starc
BANG! Full and crushed wide of mid-off.
Third new ball remains overrated. And honestly, the old ragger has done most of the damage in this game anyway.
No-one at short leg is interesting.
Two balls left. Have to bring the field up to prevent the single.
CRUNCH! Cummins prevents the single, bangs in the bouncer, and Rizwan helps himself to a boundary. Going like the clappers.
Wowee!! And he chases a very wide one to finish. Zero foot movement, almost falling over he was reaching so far.
By Jon Healy
11 overs left - Pat Cummins is allowing Lyon to continue with the new ball
Cummins must bowl himself. Not necessarily in Lyon's place. He should take Starc's place if need be.
Sajid Khan?! Lovely cover drive to within an inch of the rope, for one. Cummins chases it down even though they'd be better off with the boundary. Maybe aware of not getting the overs bowled.
By Jon Healy
By Jon Healy
12 overs left - And here comes the THIRD new ball
Mitchell Starc has it in hand. Those wickets should give him a new lease on life after a long day in the field.
A hint of swing in to Rizwan from over the wicket.
Tight leave past off stump by Rizwan.
He tries the yorker and Rizwan digs it out.
CRACK! Full and wide, so Mohammad Rizwan hammers a drive through point for four. Great shot.
By Jon Healy
No hat-trick for Nathan Lyon
He was short and straight, and Sajid Khan kept it out very easily. Shame.
By Jon Healy
NATHAN LYON HAS TWO IN TWO!! He's on a hat-trick!
Faheem Ashraf, the leftie, Lyon drifted in and spun away, caught the edge and it was taken expertly down low by Steve Smith at slip.
Oh my GOD!! Two deliveries and everything has changed.
By Jon Healy
BABAR AZAM IS OUT FOR 196!!
Lyon got one to grip, bite, bounce and hit the shoulder of the bat, balloon off the pad, and Marnus Labuschagne was awake to it.
Holy hell. That's unbelievable. Nathan Lyon, take a bow. And Babar Azam, take my heart. One of the best innings you could ever hope to witness, ending in heartbreak. He didn't get his first Test double ton, and didn't finish the job for Pakistan. He'll be gutted for a while about that, but a drawn match will ease the pain, and regardless of the result, in time, he'll learn to appreciate that innings for the marvel that it was.
A standing ovation from all of course. Cam Green going out of his way to shake his hand on the way off the field.