LAHORE: Skipper Babar Azam and opener Imam-ul-Haq smashed brilliant centuries to help Pakistan pull off their highest ODI run-chase in a six-wicket triumph over Australia in Lahore on Thursday.
Azam hit an 83-ball 114 and Haq notched a 97-ball 106 as Pakistan chased down a stiff 349-run target with six balls to spare to level the three-match series at 1-1.
Ben McDermott cracked a maiden ODI hundred in Australia's imposing total of 348-8 on a flat Gaddafi Stadium pitch.
The victory is Pakistan's first over Australia since Melbourne in January 2017. In between, they had lost 10 consecutive one-day internationals.
Pakistan's win sets up an intriguing final match at the same venue on Saturday. Australia won the first match by 88 runs on Tuesday, also in Lahore.
Haq, who hit six boundaries and three sixes, put on a robust 118-run opening stand with Fakhar Zaman (67) off 111 balls to set the platform for the chase.
Zaman smashed seven boundaries and two sixes during his 64-ball knock before he was bowled by Marcus Stoinis.
Undeterred, Haq completed his ninth hundred off 90 balls before he holed out at long-off in spinner Adam Zampa's 35th over.
Haq added 111 for the second wicket with Azam off 92 balls.
Azam reached his 15th ODI century with a single off Cameron Green, reaching the mark off 73 balls. He added 80 for the third wicket with Mohammad Rizwan before he was caught off Nathan Ellis with 40 needed off 34 balls.
When Rizwan fell for 23, Pakistan still needed 32 but Khushdil Shah cracked 27 not out with two fours and as many sixes and Iftikhar (eight not out) saw off the target in 49 overs.
Pakistan's previous highest ODI chase was 327 achieved against Bangladesh at Mirpur in 2014.
Earlier, McDermott scored 104 off 108 balls in only his fourth ODI, while Travis Head struck 89 and Marnus Labuschagne hit 59 after Australia were sent in to bat in to bat.
All-rounder Stoinis added the finishing touch with a quickfire 49, with five boundaries and a six.
Pace spearhead Shaheen Shah Afridi -- who missed Pakistan's 88-run defeat in the first ODI with a knee injury -- gave the home side a breakthrough off the third ball of the innings when he trapped Aaron Finch leg-before without scoring.
But Australia scored at will after that with McDermott and Head adding 162 off 144 balls for the second wicket, hitting boundaries with ease.
Head, who scored 101 on Tuesday, smashed five sixes and six fours before miscuing a sweep off leg-spinner Zahid Mahmood, being caught by Shaheen at short fine-leg.
McDermott added another 74 with Labuschagne, and during that stand hit spinner Khushdil over long-off boundary for six to complete a century off 102 balls.
He was finally caught off pacer Mohammad Wasim.
Despite Alex Carey and Cameron Green falling for five each, Sean Abbott chipped in with a 16-ball 28 to boost the total.
Shaheen finished with 4-63 and Wasim took 2-56, but Pakistan's Iftikhar Ahmed and Khushdil conceded 95 runs in ten overs between them.