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 U.S. 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.
Associated Press writers Jennifer Peltz and Michael Casey contributed to this report. Contact Jonathan Lemire on Twitter @JonLemire
Copyright 2013 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.