EDINBURGH—Voters were projected to defeat Scotland's heated bid for independence early Friday morning, appearing to provide a narrow escape for a British government that scrambled to dole out promises of new local powers for Edinburgh to head off the breakup of a 307-year-old union.

The tally at around 5:40 a.m. local time, which included results from 26 of the 32 districts in Scotland, showed 54% of voters rejecting the independence question and 46% favoring it. About 2.6 million votes had been counted. More than four million people were registered to vote in the election.

The British Broadcasting Corp. forecast early Friday that voters rejected independence. It said the forecast is based on its projections of results still to come from remaining districts.

While the results remained incomplete—and the pro-independence won expected victories in places like Glasgow and Dundee—the U.K. government's late press to pull out a victory averts a major embarrassment. The apparent outcome is a relief for British Prime Minister David Cameron, who agreed to the referendum in a deal two years ago with Scotland's First Minister Alex Salmond, then watched as a double-digit lead dissolved to a dead heat on the back of relentless campaigning by Mr. Salmond and the pro-independence campaign.

Mr. Cameron congratulated Alistair Darling, the Labour politician who helped spearhead the "no" camp, on a "well-fought campaign" in a message from his official Twitter account.

Mr. Darling subsequently tweeted: "An extraordinary night. Humbled by the level of support and the efforts of our volunteers."

The late surge to reject the independence movement was fueled in part by pledges of new powers that would bring more self-rule to Scotland. But the government also issued tough warnings that Scotland's economy would suffer if it escaped the U.K.'s embrace.

A key factor in interpreting the incomplete results early Friday was voter turnout, which was high across the country following a campaign that consumed Scotland—but lower in some places that would be expected to support breaking away from the U.K. Currency markets were clearly intuiting that the independence movement would be defeated, with the pound strengthening steadily against the dollar in overnight hours.

Nicola Sturgeon, deputy leader of the pro-independence Scottish National Party, told the BBC that she was "deeply disappointed" that her party appears to have lost. She added that more than one million Scots had voted for independence. "What we are not seeing, emphatically not, is any kind of endorsement of the status quo," she said.

Malcolm Harvey, a political-science researcher at the University of Aberdeen, said early Friday morning that it was looking unlikely that independence supporters could close the gap. Voter turnout in pro-union districts was higher than turnout in pro-independence districts, such as Glasgow—a signal that the "no" vote was in the driver's seat. Turnout in Glasgow was 75%, which is low compared with two districts that saw turnout above 90%. Similarly, in one region that voted strongly in favor of independence, Dundee, turnout was about 79%.

Glasgow, Scotland's biggest city, backed independence by 53% to 47%. The "yes" camp also won Dundee, an industrial town on Scotland's east coast and the districts of North Lanarkshire and West Dunbartonshire.

"I am totally heartbroken," said Heather McGuire as she cried in Glasgow's central square with a Scottish flag round her neck. "But at the end of the day I am still Scottish," she said, kissing the flag.

Early results from the islands in Scotland's north, where much of the oil flows, came in strongly for staying in the union.

Another blow for the "yes" camp was its failure to win Inverclyde, a working-class district that left-wing independence supporters had hoped to win. Brian Robertson, a pro-independence member of the largely pro-union Labour Party, said losing Inverclyde was "a big disappointment." The results showed so far that pro-independence campaigners had not been as successful as they had hoped in poorer areas, such as Invercylde.

Aberdeen, the hub of Scotland's oil industry, voted in favor of staying in the U.K.

It was an emotional day in Scotland, where voters turned out in droves to make what was among the biggest political decisions of their lives. The ballot asked a simple question—"Should Scotland be an independent country?"

Boisterous crowds gathered in the streets of Glasgow and elsewhere, waving the blue Scottish Saltire flag. Some people played bagpipes, some wore kilts.

Carrying a Scottish flag in the center of Glasgow, independence supporter Kyle McBride, 21, braced for a "No" vote. "My heart says yes but my head says no," he said. "The polls were too much for us this time." But the student said he expects there would be another chance to go for independence. "The 'Yes' campaign has absolutely rocked it. This may not be the time, but it is going to happen."

In Edinburgh, 26-year-old job seeker Ian Drummond voted "No." "I believe we are united together. We have more in common than differences," he said. "I love haggis, Irn-Bru [an orange-colored carbonated soft drink] and I have a kilt at home but this is not enough for a messy divorce from the English."

In the center of Glasgow, the crowds jeered Union Jack flags and cheered the "yes" cause. There were huge cheers at the "Better Together" campaign headquarters in Glasgow as a string of "no" victories were announced.

Mr. Salmond, leader of the Scottish National Party and the central figure in the diverse, grass-roots pro-independence campaign, has urged Scots to take the plunge, saying the nation would be richer and happier if it breaks away from the U.K.

But Mr. Cameron and other senior politicians spent the past two weeks in frantic dashes between Scotland and England to shore up support for the union. They have tried to persuade Scots that independence is fraught with economic risks that would endanger advocates' vision of a Scottish government with a freer hand to intervene to lower poverty and reduce inequality.

—Cassie Werber
and Max Colchester
contributed to this article.