David Warner scored his first century since returning from a ban as holders Australia ran out 41-run winners over Pakistan in an exciting World Cup clash at Taunton on Wednesday.
After losing to India on Sunday, Australia needed a response and Warner, back from serving a 12-month suspension for his part in last year's ball-tampering scandal, struck a classy 107 in his side's 307 all out in 49 overs.
Warner and skipper Aaron Finch shared a 146-run opening partnership, Australia's largest in ODIs in England since 1975, but Pakistan hit back with Mohammad Amir taking five wickets.
When Pakistan reached 136-2 in reply and then launched a late counter-attack through Hasan Ali, captain Sarfaraz Ahmed and Wahab Riaz a stunning win looked possible before Mitchell Starc restored order to seal a third victory in four games for Australia.
Despite beating hosts England, Pakistan have lost two of their four matches and have work to do to reach the semi-finals.
Warner, who notched his 15th ODI century, said Australia's lower-than-expected total had left the game in the balance.
"We should have been around 340-50, but credit to Pakistan, their second spells were fantastic and made it hard for us to hit down the ground," he said.
"Our bowlers bowled fantastic, they probably got closer than we expected but it was a great game."
A game of fluctuating fortunes was tipping Pakistan's way when Sarfaraz and Riaz began swinging the bat.
With six overs and three wickets in hand, Riaz had scored 45 in 39 balls with Sarfaraz well set as Pakistan reached 264-7. But Starc had Riaz caught behind off the thinnest of edges and bowled Amir before Sarfaraz was brilliantly run out for 40 by Glenn Maxwell's direct hit to end the match.
"We made some runs and got starts but we've got to convert them and go long," said Sarfaraz, whose team face India next. "If you want to win the match your top four must score runs."
His day begun badly when he won the toss and opted to field under grey skies. It looked a poor decision as Finch and Warner clattered the ball around aided by poor fielding.
Finch was dropped twice and survived a tight lbw review before falling for 82, skying Amir to Mohammad Hafeez.
Warner, who had made two pedestrian 50s in the tournament, looked much more like his old self, although Steve Smith, also back from a ban, lasted only 13 balls before slicing to extra cover off Hafeez for 10.
Shaheen Afridi bowled Maxwell for 20 before Warner reached his century with a big outside edge, celebrating wildly.
Warner was somehow dropped at third man by Asif Ali in the next over but he tried to launch Afridi and was caught by Imam-ul-Haq.
At 242-2 in the 38th over Australia still looked set for a score in the mid-300s but Pakistan hit back.
Amir removed Shaun Marsh, Usman Khawaja and Alex Carey as Australia's innings stalled, then wrapped up the innings by having Starc caught on the boundary to end with five for 30.
Pakistan, lost Fakhar Zaman to Pat Cummins for a duck and Babar Azam for a breezy 30 but Imam-ul-Haq and Hafeez brought the 100 up in 18.3 overs.
Imam was out for 53, edging a wide Cummins delivery behind to Carey and when Hafeez went in the next over Pakistan were sliding before Hasan blazed 32 in 15 balls to start the fightback.Reuters