England suffered ODI embarrassment in Edinburgh as Scotland recorded their most famous win with a dramatic six-run triumph at The Grange.
A high-scoring contest went down to the wire, with the hosts prevailing in the penultimate over to spark jubilant scenes and a pitch invasion.
Calum MacLeod's sublime, unbeaten 140 - together with strong contributions from Matthew Cross (48), skipper Kyle Coetzer (58) and George Munsey (55) - propelled Scotland to a mammoth total of 371-5, comfortably their best in ODIs.
MacLeod - his country's first centurion against England - timed the ball superbly in a magnificent 94-ball innings, but he was far from the only hero for a team who will not compete in the next Cricket World Cup after a controversial reduction in the number of competing nations.
Eoin Morgan's men are the top-ranked side in this format and, on a small ground with a flat pitch, Scotland's score did not look remotely safe as Jonny Bairstow thundered his way to 105 from 59 balls - becoming the first England batsman to register hundreds in three successive ODIs.
However, England were undermined by a succession of soft dismissals after Bairstow holed out in the 18th over.
From 276-7, the visitors threatened to get out of trouble courtesy of Moeen Ali (46) and Liam Plunkett (47 not out), but there was to be another twist in the tale.
Moeen picked out long-on and Adil Rashid was needlessly run out at the start of the 49th over, before Safyaan Sharif trapped Mark Wood lbw with a superb, inswinging yorker to end England's innings on 365.
Defeat for England was harsh on Bairstow, who had accelerated in devastating fashion midway through his boundary-laden knock. All five of his ODI hundreds have come in the last nine months.
Next up for England is a five-match ODI series against Australia, starting at The Oval on Wednesday, while Scotland can celebrate a day to remember.