Scotland's cricketers have pulled off the greatest victory in their history to beat England for the first time amid scenes of disbelief and jubilation at the tiny Grange ground in Edinburgh.

The world's top-ranked one day international (ODI) team lost by six runs after just failing to pull off what would have been the second highest ODI run chase.

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 Scottish players, who missed out on 2019 World Cup qualification after a controversial Duckworth-Lewis loss to the West Indies in March, jumped into a huddle in jubilation, as the crowd roared in delight.

Scotland's Safyaan Sharif celebrates taking the final wicket to secure the win. ( Reuters: Craig Brough )

England were all out for 365 after Scotland made 5 for 371, their highest ODI total.

The victory will send out a powerful message to the ICC, which voted to restrict the 2019 World Cup to 10 teams from the previous 14, making it far more difficult for second-tier sides to qualify.

Scotland's innings included 45 fours and eight sixes and was anchored by Calum MacLeod who made an unbeaten 140.

"I hit it nicely," said MacLeod, who plays club cricket for Bexley in England.

"It was a lovely feeling and nice to do it in a crowd this big. Anything above 350 is a big total."

Kyle Coetzer (58) and Matthew Cross (48) had got the innings off to a strong start with an opening partnership of 103 and George Munsey weighed in with 55.

A Scottish fan invades the pitch after the historic win. ( Reuters: Craig Brough )

The visitors, playing their first one-day game of the season, were given a hurricane start by Jonny Bairstow who hit a brilliant 105 to become the first Englishman to post three successive ODI centuries.

But Jason Roy (34), Eoin Morgan (20) and Alex Hales (52) departed to careless shots while Joe Root (29) was needlessly run out.

Moeen Ali tried to repair the damage with a 33-ball 46 but England had left themselves too much to do.

Loading

Spinner Mark Watt was Scotland's best bowler with 3 for 55.

"The level of expectation has been high around the team for a while, it doesn't get higher than being number one in the world," said Morgan, whose side now face a five-match one-day series against Australia starting on Wednesday.

"I don't think we were far away. We go to a ground now that we know really well in The Oval, and we'll be up for the challenge."

The win sparked plenty of jokes and debate on social media, including many joking the victory should allow for automatic independence from the United Kingdom.

Other jokes surrounded the fact Scotland has now drawn or beaten England at its traditional sports in the last 12 months, after a 2-2 draw in a football World Cup Qualifier in June 2017, and a 25-13 rugby victory in the Six Nations in February.

Loading

Retired English Premier League footballer Chris Sutton, who played for six years at Scottish giants Celtic, said it was a big win in a sport many in Scotland did not support.

"Blimey Scotland have beaten England at what Henrik Larsson calls rounders … Bad day for English cricket!! Well played Scotland!!," Sutton tweeted.

Television host and journalist Piers Morgan, a well-known lover of cricket, was also in disbelief.

"When did Scotland get good at cricket?," he wrote on Twitter.

Indian cricket great Sachin Tendulkar said the win proved that smaller cricketing nations should be allowed to play in the World Cup next year.

"Cricket has all the ingredients to become a global game. Teams with massive potential like, Afghanistan, Ireland, Scotland along with many others have to be given more opportunities to play against the more experienced teams. Best way to provide great exposure," he wrote.

Reuters/ ABC