Bill de Blasio has become New York City's first Democratic mayor in more than 20 years, running on an unabashed liberal, tax-the-rich platform contrasting sharply with billionaire Michael Bloomberg's 12 years in office.
With 14% of precincts reporting, Mr de Blasio, the city's public advocate, had 73% of the vote compared with 24% for Republican Joe Lhota, former chief of the metropolitan area's transport agency.
In his victory speech, delivered in both English and Spanish, Mr de Blasio, 52, declared that "our city shall leave no New Yorker behind".
"The people of this city have chosen a progressive path," he said, addressing a rollicking crowd of supporters at the YMCA in his home neighbiorhood of Park Slope, Brooklyn - a far cry from the glitzy Manhattan hotel ballrooms that usually host election night parties.
Mr de Blasio will take office on January 1 as the 109th mayor of America's largest city. He had been heavily favoured, holding an overwhelming lead in the polls for weeks.
Mr Bloomberg, who first ran as a Republican and later became an independent, guided the city through the financial meltdown and the aftermath of the September 11 2001 terrorist attacks. He is leaving office after three terms.
Mr de Blasio ran as the anti-Bloomberg, railing against economic inequality and portraying New York as a "tale of two cities" - one rich, the other working class - under the pro-business, pro-development mayor, who made his fortune from the financial information company that bears his name.
He reached out to New Yorkers he contended were left behind by the often Manhattan-centric Bloomberg administration and called for a tax increase on the wealthy to pay for universal pre-nursery education. He also pledged to improve economic opportunities in minority and working-class neighbourhoods.
He condemned alleged abuses under the police stop-and-search policy and enjoyed a surge when a federal judge ruled that police had unfairly singled out blacks and Hispanics.
White Mr de Blasio, married to a black woman, also received a boost from a campaign ad featuring their son, a 15-year-old with a big Afro.
Despite his reputation for idealism, he has also shown a pragmatic side, having worked for both Bill and Hillary Clinton and governor Andrew Cuomo, and was known for closed-door wheeling-and-dealing while serving on the city council.
Mr Lhota called Mr de Blasio to concede about half an hour after polls closed.
"It was a good fight and it was a fight worth having," Mr Lhota told supporters in a Manhattan hotel before offering a word of caution to the victor.
"We want out city to move forward and not backward, and I hope our mayor-elect understands that before it's too late," he said.
Mr Lhota, 59, a former deputy mayor to Rudolph Giuliani, spent much of the campaign slamming Mr de Blasio's "tale of two cities" appeal as class warfare and argued that Mr de Blasio's time in the 1980s with the left-wing Sandinistas in Nicaragua as an aid worker and activist made him a Marxist.
Mr Lhota also credited stop-and-search with contributing to the city's drop in crime. and said a de Blasio victory would return the city to its crime-filled past.
Though polling shows New Yorkers largely approve of Mr Bloomberg's policies, those same surveys revealed the city was hungry for a change.
Mr Bloomberg also called Mr de Blasio to offer his congratulations, according to the mayor-elect's campaign spokeswoman.
Democrats also captured the other two citywide races: Letitia James, a Brooklyn city councillor, was elected public advocate, while Scott Stringer, the Manhattan borough president, was chosen to be comptroller.
Meanwhile governor Chris Christie, seen as a strong contender for president in 2016, declared victory in his re-election bid, thanking New Jersey's voters for "making me the luckiest guy in the world".
Mr Christie, who made his victory speech in the shore town of Asbury Park, became the first Republican on the ballot statewide in New Jersey since George Bush senior's presidential campaign in 1988 to get more than 50% of the votes in the state.
With 69% of precincts reporting, Mr Christie had 60% of the vote to Democratic state senator Barbara Buono's 39%.
Elsewhere, voters in predominantly black Detroit elected the city's first white mayor in four decades.
Unofficial results showed former medical centre chief Mike Duggan defeating Wayne County Sheriff Benny Napoleon 55% to 45%.
Finances in the stricken city are currently controlled by a state-appointed emergency manager, and by the time Mr Duggan takes office in January, a federal judge might have ruled the city bankrupt.
Mr Duggan also will be expected to have solutions for lowering one of the nation's highest violent crime rates and fixing block upon block of crumbling neighbourhoods.