Pakistan shocked England by 14 runs at Trent Bridge as they ended an 11-match losing streak in ODIs despite two centuries for the World Cup hosts.
Joe Root (107) and Jos Buttler (103) were guiding the tournament favourites towards an imposing target of 349 after Pakistan left England needing a World Cup record chase.
The pair put on 130 for the fifth wicket but both were out shortly after reaching their hundreds and the tail had too much to do.
It was a remarkable turnaround for Pakistan, whose opening match of this World Cup had seen then slump to 105 all out in a seven-wicket defeat by the West Indies at the same ground on Friday.
But Pakistan started strongly on Monday and made 348-8, Mohammad Hafeez top-scoring with 84.
Video is Not allowed in your region
Pakistan vs England highlights
No side had previously made more batting second to win a World Cup match than Ireland, with 329-7 against England at Bangalore in 2011.
England's chase got off to a bad start when Jason Roy was lbw on the sweep to Shadab Khan to leave them 12 for one.
Jonny Bairstow then fell for 32 when he was caught behind off Wahab Riaz before England captain Eoin Morgan (9) and Ben Stokes (13) were dismissed cheaply.
But Buttler and Root hit towering sixes off Hafeez as England accelerated. Root pulled Hasan Ali for four to go to 97 before his quick single off Riaz saw him to a 15th ODI century in 97 balls, with nine fours and a six.
But he fell soon afterwards, steering Shadab to Hafeez at short third man to end a stand of 130 with Buttler.
Buttler, one delivery after completing a 75-ball century, was also caught at short third man, by Riaz off Mohammad Amir.
From then on England were struggling and not even Chris Woakes' brisk 21 could prevent a Pakistan victory cheered to the echo by their loyal fans.
Earlier, Hafeez starred in an innings where Babar Azam (63) and Pakistan captain Sarfaraz Ahmed (55) also made fifties.
Pakistan were bounced out by the West Indies and England deployed similar tactics after Morgan won the toss.
But Pakistan coped and it was off-spinner Moeen Ali who took the first three wickets.
England were surprisingly sloppy in the field, while their fast bowlers were expensive -- Jofra Archer's 10 wicketless overs cost 79 runs.
Pakistan attacked from the start, with openers Fakhar Zaman and Imam-ul-Haq sharing a stand of 82.
Babar completed a run-a-ball fifty while Hafeez pressed on after being dropped on 14 when Roy floored a sitter at long-off.