(CNN) - New York City voters Tuesday elected a Democrat to the mayor's office for the first time in two decades, giving progressive city Public Advocate Bill de Blasio a victory over Republican nominee Joe Lhota, Edison Media Research projects.
"Make no mistake: The people of this city have chosen a progressive path, and tonight we set forth on it, together, as one city," de Blasio said in his victory speech.
Follow @politicalticker Follow @KilloughCNN
De Blasio had been widely expected to pull out a landslide win. In the days before the election, polls indicated he was ahead of his opponent by about 40 percentage points.
"To everyone whose vote I didn't earn today, I promise I won't stop working to earn your trust," de Blasio said in his message, which was focused on combating inequality in New York.
At the center of the race were disagreements over taxes and the city's controversial "stop-and-frisk" program backed by incumbent Mayor Michael Bloomberg.
De Blasio campaigned on a promise to raise taxes on those earning more than $500,000 a year to pay for universal pre-kindergarten, an idea Lhota vehemently opposed.
While Lhota painted himself as a fiscal conservative, he sought distance from national Republicans on social issues by reiterating his support of abortion rights and same-sex marriage.
As for the stop-and-frisk policing tactics - which critics call racial profiling - de Blasio said he would replace Police Commissioner Raymond Kelly, appoint an independent inspector general and take sufficient steps to end the searches.
Lhota, former GOP Mayor Rudolph Giuliani's deputy and former head of the city Transit Authority, pointed to the sharp reduction of crime under Kelly and was more eager to defend the program, though he agreed it needed to be reworked.
The stop-and-frisk policy - in which police stop, question and frisk people they deem suspicious, even if they've committed no crime - has been one of the most controversial policing techniques in recent time. Law enforcement and other proponents say the practice works to reduce crime.
The mayoral race in the Big Apple was often called a political circus before the primary, when former Rep. Anthony Weiner faced new allegations of his infamous sexting habits.
Weiner had strong numbers in the polls as he started his campaign, suggesting New York was ready to forgive the disgraced ex-congressman. But those numbers quickly plummeted as he refused to drop out of the race after he admitted to having online relationships with women even after he resigned from Congress.
He eventually placed fifth in the crowded Democratic primary.
City Council Speaker Christine Quinn, a lesbian who would have been the city's first female mayor, was also thought to be a strong contender early on. But as the months went on leading up to Primary Day, she saw her numbers slip, as de Blasio and former comptroller Bill Thompson gained more popularity.
De Blasio, who rose to prominence while also spotlighting his interracial family, narrowly avoided a runoff with Thompson.
The last Democrat to win the office was David Dinkins in 1989.