The latest figures put Kathryn Garcia, the city's former sanitation chief, only slightly behind Adams, with Maya Wiley, a former MSNBC analyst and civil rights lawyer, in a close third.
The final outcome remains uncertain, with none of the approximately 125,000 absentee ballots counted yet.Election officials are not expected to finish counting all the votes until mid-July.
The winner of the primary will be a heavy favorite in November's general election against Republican nominee Curtis Sliwa, the founder of the Guardian Angels civilian patrol group. Democratic voters outnumber Republicans in the United States' most populous city by a more than a six-to-one ratio.
The next mayor will oversee the city's nascent recovery from the coronavirus pandemic but will also have to contend with a recent spike in violent crime.
Adams held a substantial lead on Election Day eight days ago, based on the first-choice ballots from New Yorkers who voted in person.
But this year's Democratic mayoral race for the first time is using ranked-choice voting, which allows voters to rank up to five candidates in order of preference. read more
Under the system, the election results are tabulated via a series of instant run-offs: the last-place candidate is eliminated, with his or her votes redistributed to voters' second choice, and the process repeats until there is a majority winner.
After eight rounds of elimination, Adams had 41% of the vote, with Garcia just under 30% and Wiley fewer than 400 votes behind her. When Wiley's votes were reallocated in the 9th and final round, Adams finished with 51%, while Garcia stood at 49%.
The city Board of Elections intends to rerun the ranked choice analysis next week, incorporating at least some absentee ballots.
In a statement, Adams' campaign said it was confident he would remain the leader after all ballots are counted. Garcia said she also was "confident in our path to victory" and urged New Yorkers to stay patient.
Wiley said the election was "wide open," given the number of outstanding absentee ballots still to be counted, and called on the elections board to count all votes openly after Tuesday's "embarrassing debacle."
The board had posted an initial ranked-choice tabulation on Tuesday but was forced to pull it down after realizing the totals included some 135,000 test ballots that were never removed from the software.
The snafu was the latest in a series of problems for the board, whose reputation for dysfunction has drawn criticism for years. Last year, during the pandemic, it sent many absentee ballots too late to be used and printed the wrong voters' names on some envelopes; two hotly contested congressional races took six weeks to count.
The state Senate majority leader, Democrat Andrea Stewart-Cousins, called the situation in the mayoral race "a national embarrassment" and said the Senate would hold hearings in the coming weeks to consider reform legislation.
The error could also undermine public confidence in the new ranked-choice voting system.
Preliminary totals released on election night showed Adams was listed as the first choice on 31.7% of in-person votes. Wiley was in second place with 22.2%, with Garcia just behind at 19.5%.
Andrew Yang, the former presidential candidate, finished in fourth place and conceded after polls closed.
Adams, 60, is a former police captain whose candidacy was boosted as public safety became voters' No. 1 issue amid a spate of shootings. A moderate Democrat, he called for increasing police resources, while also vowing to address systemic racial bias.
Wiley, who emerged as the leading liberal candidate, proposed cutting one-sixth of the police budget to fund social services. Garcia, a government veteran, ran as a technocrat who could best manage the city's crises.
The race - taking place in a city of more than 8 million - was widely seen as a crucial test of ranked-choice voting, or RCV, which has been used in a handful of U.S. elections. Proponents say it allows voters to choose the candidates they like best, without worrying about wasting their votes.
Susan Lerner, the executive director of the good government group Common Cause New York and a supporter of RCV, said on Wednesday that the error had nothing to do with the system itself. Reporting by Joseph Ax Editing by Colleen Jenkins, Jonathan Oatis and Sonya Hepinstall