Mohammad Amir took a one-day international best five for 30 as Pakistan bowled Australia out for 307 in a World Cup match in Taunton on Wednesday.
David Warner made 107 — his first international century since he completed a year-long ban for ball-tampering.
Australia were set for a huge total while Warner and captain Aaron Finch (82) were sharing a first-wicket stand of 146 — the highest partnership for any wicket at this World Cup to date.
But left-arm quick Amir, on the ground where he returned to first-class cricket in England in 2016 after completing a spot-fixing ban, dragged Pakistan into the game.
His figures surpassed his previous best of 4-28 against Sri Lanka in Colombo in 2009 and are the best in the tournament so far.
Amir ended the innings with an over to spare when tailender Mitchell Starc holed out.
Both Warner and Steve Smith, also returning from a year-long ban for ball-tampering, had been jeered by fans in previous group matches.
Pakistan fans largely heeded a pre-match appeal from captain Sarfaraz Ahmed not to boo the pair, preferring to roar chants of “Amir! Amir!” as he ran in.
Amir was on target right from the start after Sarfaraz won the toss on an overcast morning at southwest county Somerset’s headquarters.
He started with a probing maiden — one of two in an initial four-over spell that cost a mere 11 runs.
Finch should have been out for 26 when he edged Wahab Riaz only for first slip Asif Ali to floor a head-high catch
He was dropped again on 44 when wicket-keeper Sarfaraz could not hold a tough chance following an edged cut off Mohammad Hafeez’s second ball.
Finch cashed in, hitting off-spinner Hafeez for two successive fours as he completed a 63-ball fifty.
The skipper then hoisted Hafeez for two legside sixes in as many balls.
But Finch gave his wicket away when he miscued a big shot immediately upon Amir’s return only to miscue, with Hafeez taking a fine catch running back from cover.
Finch and Warner’s stand surpassed the 142 shared by Bangladesh’s Mushfiqur Rahim and Shakib Al Hasan against South Africa.
Warner completed his 15th one-day international hundred when an outside edge off Shaheen Shah Afridi flew past slip Asif for his 11th four.
He reached his hundred off 102 balls, including one six.
A joyful Warner leapt in the air in celebration.
But he was out soon afterwards, caught at deep point by Imam-ul-Haq off Shaheen, having gone past fifty for the third time in four innings this World Cup.
Smith (10) holed out off Hafeez, with frontline batsmen Shaun Marsh, Usman Khawaja and Alex Carey all falling to Amir.