The UK has voted by 52% to 48% to leave the European Union after 43 years in an historic referendum, a BBC forecast suggests.
London and Scotland voted strongly to stay in the EU but the remain vote has been undermined by poor results in the north of England.
Voters in Wales and the English shires have backed Brexit in large numbers.
The pound fell to its lowest level against the dollar since 1985 as the markets reacted to the results.
Referendum turnout was higher than at last year’s general election.
Labour’s Shadow chancellor John McDonnell said the Bank of England may have to intervene to shore up the pound, which lost 3% within moments of the first result showing a strong result for Leave in Sunderland and fell as much as 6.5% against the euro.
UKIP leader Nigel Farage – who has campaigned for the past 20 years for Britain to leave the EU – told supporters “this will be a victory for ordinary people, for decent people”.
Mr Farage – who predicted a Remain win at the start of the night after polls suggested that would happen – said Thursday, 23 June would “go down in history as our independence day”.
He called on Prime Minister David Cameron, who called the referendum but campaigned passionately for a Remain vote, to quit “immediately”.
A Labour source said: “If we vote to leave, Cameron should seriously consider his position.”
But pro-Leave Conservatives including Boris Johnson and Michael Gove have signed a letter to Mr Cameron urging him to stay on whatever the result.
Labour former Europe Minister Keith Vaz told the BBC the British people had voted with their “emotions” and rejected the advice of experts who had warned about the economic impact of leaving the EU.
He added: “It will be catastrophic for our country, for the rest of Europe and for the rest of the world.”
Scotland’s First Minister Nicola Sturgeon has said that the EU vote “makes clear that the people of Scotland see their future as part of the European Union” after all 32 local authority areas returned majorities for Remain.
Britain would be the first country to leave the EU since its formation – but a leave vote will not immediately mean Britain ceases to be a member of the 28-nation bloc.
That process could take a minimum of two years, with Leave campaigners suggesting during the referendum campaign that it should not be completed until 2020 – the date of the next scheduled general election.
The prime minister will have to decide when to trigger Article 50 of the Lisbon Treaty, which would give the UK two years to negotiate its withdrawal.
Once Article 50 has been triggered a country can not rejoin without the consent of all member states.
Mr Cameron has previously said he would trigger Article 50 as soon as possible after a leave vote but Boris Johnson and Michael Gove who led the campaign to get Britain out of the EU have said he should not rush into it.
But they also said they want to make immediate changes before the UK actually leaves the EU, such as curbing the power of EU judges and limiting the free movement of workers, potentially in breach the UK’s treaty obligations.
The government will also have to negotiate its future trading relationship with the EU and fix trade deals with non-EU countries.
In Whitehall and Westminster, there will now begin the massive task of unstitching the UK from more than 40 years of EU law, deciding which directives and regulations to keep, amend or ditch.
The Leave campaign argued during a bitter four-month referendum campaign that the only way Britain could “take back control” of its own affairs would be to leave the EU.
Leave dismissed warnings from economists and international bodies about the economic impact of Brexit as “scaremongering” by a self-serving elite.