Democrat Bill de Blasio has been declared the winner of New York City's mayoral race by NY1, the New York Times and CNN.

De Blasio defeated Republican Joe Lhota.

De Blasio, the city's public advocate, had a 40-point lead on his rival in public opinion polls heading into Election Day. He will replace Mayor Michael Bloomberg.

Below, more from the Associated Press:

Bill de Blasio was elected New York City's first Democratic mayor in two decades Tuesday, running on an unabashedly liberal, tax-the-rich platform that contrasted sharply with billionaire Michael Bloomberg's record during 12 years in office.

With 21 percent of precincts reporting, De Blasio, the city's public advocate, had 72 percent of the vote compared with 26 percent for Republican Joe Lhota, former chief of the metropolitan area's transit agency.

De Blasio, 52, will take office on Jan. 1 as the 109th mayor of the nation's largest city.

He 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.

"Today you spoke loudly and clearly for a new direction for our city," de Blasio told a rollicking crowd of supporters at the YMCA in his home neighborhood of Park Slope, Brooklyn, a far cry from the glitzy Manhattan hotel ballrooms that usually host election night parties.

"We are united in the belief that our city should leave no New Yorker behind," he said. "The people of this city have chosen a progressive path, and tonight we set forth on it together as one city."

De Blasio, who held a commanding lead in the polls throughout the campaign, reached out to New Yorkers he contended were left behind by the often Manhattan-centric Bloomberg administration, and he called for a tax increase on the wealthy to pay for universal pre-kindergarten. He also pledged to improve economic opportunities in minority and working-class neighborhoods.

He decried alleged abuses under the police department's stop-and-frisk policy and enjoyed a surge when a federal judge ruled that police had unfairly singled out blacks and Hispanics. The candidate, a white man 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 Rodham Clinton and Gov. Andrew Cuomo, and was known for closed-door wheeling-and-dealing while serving on the City Council.

If de Blasio's margin of victory holds, it will surpass Abe Beame's 40-point win in 1973 as the largest by a non-incumbent since five-borough elections began in 1897.

Lhota called de Blasio to concede about half an hour after polls closed at 9 p.m, according to a spokeswoman for the Democratic candidate.

"It was a good fight and it was a fight worth having," Lhota told a crowd of supporters in a Manhattan hotel before offering a word of caution to de Blasio.

"Despite what you might have heard, we are all one city," Lhota said. "We want our city to move forward and not backward, and I hope our mayor-elect understands that before it's too late."

Lhota, 59, spent much of the campaign slamming de Blasio's "tale of two cities" appeal as class warfare and argued that de Blasio's time in the 1980s with the left-wing Sandinistas in Nicaragua as an aid worker and activist made him a Marxist.

Lhota also credited stop-and-frisk with contributing to the city's drop in crime. He charged that a Blasio victory would return the city to its crime-filled past, a point he made with a TV ad that depicted graphic images of violence from decades ago.

Though polling shows New Yorkers largely approve of Bloomberg's policies, those same surveys revealed the city was hungry for a change.

While registered Democrats outnumber Republicans in the city 6 to 1, the last time a Democrat was elected mayor was 1989, when David Dinkins, de Blasio's former boss, was victorious.

Lhota, a onetime deputy mayor to Rudolph Giuliani, announced his mayoral bid on a surge of acclaim for his leadership of the Metropolitan Transportation Authority during last year's Superstorm Sandy. But his campaign struggled out of the gate, and he was slow to raise money.

De Blasio was an afterthought for much of the crowded Democratic primary, spending most of the year in a distant fourth, trailing City Council Speaker Christine Quinn, former Rep. Anthony Weiner and the Democrats' 2009 nominee, Bill Thompson.

But Thompson's campaign never ignited, and Quinn could not shake her role in the decision to amend the city's term limits to let Bloomberg run again in 2009. When Weiner's support imploded after another sexting scandal, many of his backers went to de Blasio.

Bloomberg, who first ran as a Republican and later became an independent, guided the city through the financial meltdown and the aftermath of 9/11. He is leaving office after three terms.

Cuomo released a glowing statement, saluting his "true friend" on his victory.

Democrats also captured the other two citywide races: Letitia James, a Brooklyn city councilwoman, was elected public advocate, while Scott Stringer, the Manhattan Borough President, was chosen to be comptroller.

For other election news, visit HuffPost's live results page here.

Also on HuffPost:

Loading Slideshow...
  • Bill de Blasio

    Currently the city's Public Advocate, <a href="http://www.billdeblasio.com/" target="_blank">Bill de Blasio announced his bid for mayor in January 2013.</a> He has supported the paid sick leave bill,<a href="http://www.huffingtonpost.com/bill-de-blasio/humane-alternatives-for-h_b_821291.html" target="_blank"> banning horse-drawn carriages</a>, and has been fiercely <a href="http://www.nytimes.com/2010/01/19/nyregion/19homeless.html" target="_blank">critical of Mayor Michael Bloomberg's homeless policies. </a>

  • Anthony Weiner

    Former Democratic congressman <a href="http://www.huffingtonpost.com/2013/05/22/anthony-weiner-2013-mayoral-race_n_3316704.html" target="_blank">Anthony Weiner finally announced his bid for mayor</a> in May after months of intense speculation by the media and politicians alike. In 2011, an embarrassing sexting scandal forced Weiner to resign from Congress. The lewd photos, along with his denial and subsequent admission, kept him out of the political spotlight until this spring.

  • John Liu

    As the city's current comptroller, <a href="http://johnliu2013.com/" target="_blank">John Liu</a> oversees New York City's finances. <a href="http://www.huffingtonpost.com/2012/03/25/comptroller-john-liu-ackn_n_1378211.html" target="_blank">Despite a federal investigation accusing two former aides to Liu of breaking campaign finance laws</a>, Liu announced his candidacy for mayor in March. In a recent interview, <a href="http://www.dnainfo.com/new-york/20130319/new-york-city/john-liu-says-all-democratic-mayoral-candidates-are-basically-same" target="_blank">Liu said, "We are all liberal Democrats"</a> and suggested Democratic mayoral hopefuls were all the same, differing on only a few issues such as stop and frisk. If elected, Liu would become the city's first Asian-American mayor.

  • Christine Quinn

    <a href="http://www.quinnfornewyork.com/announcement?splash=1" target="_blank">Christine Quinn</a> is the current City Council Speaker of New York City. She is said to be Mayor Michael Bloomberg's favorite candidate.

  • Bill Thompson

    From 2002-2009, <a href="http://billthompsonformayor.com/" target="_blank">Bill Thompson served as New York City's Comptroller. </a> Thompson, a Democrat, ran for mayor in 2009 against Bloomberg. He was outspent 14 to 1 by Bloomberg, and still only lost by a few percentage points.

  • Adolfo Carrion Jr.

    Adolfo Carrion, Jr. was the Bronx Borough President from 2002 to 2009 and was appointed by the Obama administration as the Regional Director for HUD's New York office. <a href="http://www.carrion2013.com/" target="_blank">He is running for mayor as an independent. </a>

  • Erick Salgado

    Staten Island's <a href="http://www.salgadonyc.com/" target="_blank">Rev. Erick Salgado </a>announced his Democratic candidacy for mayor, despite a socially <a href="http://politicker.com/2013/02/erick-salgados-odd-coalition/" target="_blank">conservative agenda</a> which includes anti-gay marriage, pro-life policies.

  • Sal Albanese

    <a href="http://www.salalbanese2013.com/" target="_blank">Sal Albanese</a> is a former city council member also hoping to win the Democratic primary. He also worked as a New York City public school teacher. <a href="http://www.capitalnewyork.com/article/politics/2012/12/6850576/former-brooklyn-councilman-sal-albanese-make-third-try-mayor" target="_blank">This will be his third bid for mayor of New York City. </a>

  • Joseph Lhota

    Before launching his GOP candidacy for mayor, <a href="https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&ved=0CDoQFjAB&url=http%3A%2F%2Fjoelhotaformayor.com%2F&ei=TOJ2UeXyAqT00QGe8oHYBA&usg=AFQjCNHVt6kspcgFB31wwgs6FO44kr2fSQ&bvm=bv.45580626,d.dmQ" target="_blank">Joseph Lhota</a> served as MTA chairman and served as the City’s Budget Director in Mayor Giuliani’s first term, and Deputy Mayor for Operations during the second. In 1999, he fought a public battle against the Brooklyn Museum to remove a portrait of the Virgin Mary containing elephant dung. <a href="http://www.nytimes.com/2013/03/28/nyregion/for-lhota-mayoral-hopeful-who-lost-fight-to-remove-art-no-regrets.html?pagewanted=all" target="_blank">He lost. </a>

  • John Catsimatidis

    <a href="https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&cad=rja&ved=0CEcQFjAC&url=http%3A%2F%2Fwww.cats2013.com%2F&ei=SON2UaHQG6nq0gGq3oCoDw&usg=AFQjCNELoeyQyeiyb-RKgsBoAZmaMq38vA&bvm=bv.45580626,d.dmQ" target="_blank">John Catsimatidis </a>. a Republican candidate for mayor, is a billionaire supermarket mogul. He is known for his pro-NYPD policies and <a href="http://www.nypost.com/p/news/local/mayoral_hopeful_john_catsimatidis_JtW3R5pgD1OwpRnbvWSuyM" target="_blank">supports the continuation of the department's controversial stop-and-frisk program. </a>

  • George McDonald

    <a href="https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&cad=rja&ved=0CEwQFjAC&url=http%3A%2F%2Fwww.mcdonald2013.com%2F&ei=9uN2Ub7OAc-C0QGmooCQCA&usg=AFQjCNFKEjqwcjPtmMrF_o2C8pw_dLzGjA&bvm=bv.45580626,d.dmQ" target="_blank">George McDonald</a> is the founder and president of The Doe Fund, a non-profit that seeks to help homeless and formerly incarcerated individuals find work. He has never held public office. He initially identified himself as a Democrat but has since switched to the Republican party. McDonald has received criticism for trying to challenge <a href="http://www.nytimes.com/2013/03/25/nyregion/george-t-mcdonald-ends-effort-t-o-sidestep-a-city-cap-in-mayors-race.html" target="_blank">campaign contribution limits. </a>

  • Anthony Weiner

    Former Democratic congressman <a href="http://www.huffingtonpost.com/2013/05/22/anthony-weiner-2013-mayoral-race_n_3316704.html" target="_blank">Anthony Weiner finally announced his bid for mayor</a> in May after months of intense speculation by the media and politicians alike. In 2011, an embarrassing sexting scandal forced Weiner to resign from Congress. The lewd photos, along with his denial and subsequent admission, have since dogged his political career, but a <a href="http://www.huffingtonpost.com/2013/05/28/anthony-weiner-nyc-mayor_n_3347673.html" target="_blank">recent poll revealed many New Yorkers were willing to forgive and forget</a>, with voters putting him at second only behind frontrunner Christine Quinn.