After Jonny Bairstow's 105 off 59 balls, and Alex Hales' 52, England looked like it was creeping toward victory thanks to a 71-run eighth-wicket partnership between Moeen Ali (46) and Liam Plunkett (47 not out).
Scotland's Safyaan Sharif sparked a pitch invasion when he trapped Mark Wood lbw with an in-swinging yorker in the 49th over just when England looked like they might avoid an infamous defeat that ranks alongside their loss to Ireland at the 2011 World Cup.
The win came in Scotland's first match since they agonisingly just missed out on qualification for the 2019 World Cup in Zimbabwe in March.
They might give it, we might give it but as long as it is in keeping with the spirit of the game, that's fine. "England are a brilliant side but scoring 371 against them means the world".
Scotland's historic win over England has led to praise from Indian batting great Sachin Tendulkar, who has called for the sport's second-tier teams to get more opportunities to prove themselves against top sides.
But England's weakness is their bowling and even a reduced Australia team here at the moment has the potential to make some very big scores over the rest of this month in a five match series that starts at the Oval on Wednesday.
Bairstow fell slightly short of that but he still became the first Englishman to hit three successive one-day hundreds when he reached the fastest of his five 50-over centuries all made since September, this one off 54 balls. Kyle Coetzer scored 58 and George Munsey 55.
But they lost both openers in quick succession to be 107 for two.
None more so than MacLeod, 29, who was simply superb in racing to three figures off 70 balls to become the first Scot to score a hundred against England and inspire his side to their highest score in any 50-over global.
"We showed we were capable of this past year against Sri Lanka and then to take the step up to beat a full England side, number one-ranked in the world, is a massive statement from Scottish cricket".
Victory completed a notable double over England for the Sole family.
The six-run win saw Scotland get one over their arch-rivals in style.