New York's public advocate Bill De Blasio appears to have won the Democratic mayoral primary.
The Democratic endorsement is a springboard to becoming the next mayor of the city and with 97 per cent of ballots counted across the Big Apple, the 52-year-old stood at 40.2 per cent of the vote, a hair's breadth above the magic number needed to avoid an October 1 run-off.
De Blasio's victory followed a bruising campaign overshadowed by the lurid sex scandal embroiling rival Anthony Weiner, who trailed in last with 5 per cent.
However, given the razor-thin margin, the city's former financial controller Bill Thompson in second place with 26.2 per cent, held out hope that De Blasio would drop below the 40 per cent mark and force a run-off.
New York is overwhelmingly Democratic, even though it has not elected a mayor from that party in 20 years.
The Democrat candidate will be seen as most likely to replace Michael Bloomberg, the billionaire mayor who has led the city for the past 12 years.
Republican candidate Joe Lhota scored a decisive victory with 52.6 per cent to businessman John Catsimatidis' 40.7 per cent.
Observers have said the winning Democrat candidate may have a tough time against Lhota - former public transport chief and former deputy mayor to Rudolph Giuliani who was endorsed by the New York Times - in the mayoral election.
Former Democratic frontrunner, openly gay city council speaker Christine Quinn, suffered a blow to her campaign, coming in third with 15.3 per cent.
Elections officials are expected to count an additional 30,000 or more votes in coming days as absentee ballots arrive by mail and paperwork comes in from voters who had problems at the polls. A final result may not be known for 10 days.
The winner in November will assume the helm of the nation's largest city at a critical juncture, as it experiences shrinking crime rates yet widening income inequality, and as the nearly completed One World Trade Centre building symbolises a new era after the terrorist attacks of 2011.
The exit polling showed the appeal of De Blasio to be broad-based: He was ahead in all five boroughs; was ahead of Quinn with female voters; and ahead of Thompson, the only African-American candidate, with black voters.
In the closely watched race for New York City controller, Manhattan Borough President Stringer defeated ex-Governor Eliot Spitzer, who was seeking a return to politics after resigning New York's Governor's office in 2008 amid a prostitution scandal.
De Blasio has fashioned himself as the cleanest break from the Bloomberg years, proposing a tax on the wealthy to fund universal pre-kindergarten and changes to city police practices he says discriminate against minorities.
De Blasio's late surge was as sudden as it was unexpected.
- AFP, AP