Electoral officials said early Friday that the "Leave" campaign had racked up 17.4 million votes — compared to 16.1 million backing the status quo. That gave "Leave" 51.9 percent of the ballots against 48.1 percent for "Remain," capping a deeply divisive campaign.
The vote served as an indictment of Britain's government and a barometer of domestic fears about immigration and the economy.
The EU now finds itself in uncharted waters: No nation state has ever left the bloc. The leaders of the EU institutions urged Britain to act quickly to formalize its exit "however painful that process may be."
Beyond the European implications, a Brexit also puts Britain’s so-called "special relationship" with the U.S. in an uncomfortable position. President Barack Obama had urged British voters to remain in the EU — the U.K. is America’s strongest military ally and the U.S. has a vested interest in its overall role in Europe.
He downplayed any fears of a potential rift on Friday, saying in a statement that "the special relationship between the United States and the United Kingdom is enduring."
"The people of the United Kingdom have spoken, and we respect their decision," Obama added.
While the outcome of the referendum is clear, what comes next is anything but. Questions remain over how the exit will play out and what the U.K.'s new relationship with will Europe look like. Trade deals with the EU members must now be renegotiated. Will the scores of Europeans working freely in Britain — and vice versa — be forced to get work permits, or return home?
Nadine Michel, a 33-year-old German national living in London, wondered if she'd need a visa to stay in the country.
"Everyone kept texting me this morning saying 'What's gonna happen? Do we have to pick you up at the airport? Do you have to leave?" she told NBC News. "It's confusing and a bit terrifying, because basically we don't know what's gonna happen."
Amid the sweeping uncertainty former London mayor and leading "Leave" campaigner Boris Johnson told a press conference that Britain will not turn its back on Europe but can now "find our voice in the world."
"A voice that is commensurate with the fifth-biggest economy on earth: Powerful, liberal, humane and an extraordinary force for good," he said.
As Britons digested the news, the mood among pro-"Leave" supporters in London was electric.
"It's great, it's fantastic," 24-year-old electrician Michael Timon told NBC News. "We can finally start being Britain again. Start saving some money."
But mainland Europe — where many nations had pleaded with Britain to remain — was reeling.
Germany's Foreign Minister Frank-Walter Steinmeier calling the news "truly sobering."
"It looks like a sad day," he said in a statement.
French President Francois Hollande described the vote as a "tough test for Europe," while his Prime Minister Manuel Valls called it "an explosive shock."
"At stake is the break up pure and simple of the union," Valls said in a statement. "Now is the time to invent another Europe."
Cassandra Vinograd is a Senior Writer and News Editor. Before joining NBC News, she worked as a London-based correspondent for The Associated Press and specialized in politics, foreign affairs and defense.
Vinograd previously worked as an editor for The Wall Street Journal in Brussels and London.
She has reported extensively from Afghanistan and on West Africa and the Middle East.
Mo Abbas, Alex Moe and The Associated Press contributed.