New York City Public advocate Bill de Blasio, who was criticized by outgoing New York City Mayor Michael Bloomberg (I), is closer to replacing Bloomberg after winning the local Democratic primary Tuesday night.

WNYC-FM reported that de Blasio managed to win 40 percent of Democratic voters. If his lead holds, he'll avoid a runoff with second-place finisher Bill Thompson. He will face former Metropolitan Transit Authority head Joseph Lhota on Nov. 5.

WCBS-TV reported that Lhota captured 52 percent of Republican voters in defeating followed by billionaire John Catsimatidis, who had 41 percent of the vote.

de Blasio's campaign surged in the final weeks of the primary, with his visibility growing after Bloomberg called his campaign "class warfare" and "racist" in an interview with New York Magazine.

City Council speaker Christine Quinn finished with 15 percent of the vote, followed by city Comptroller John Liu, who had 7 percent, and former Rep. Anthony Weiner (D-NY), whose scandal-plagued campaign ended with him garnering 5 percent of the vote and a photo circulating online of him flipping a reporter "the bird" after his concession speech.

In another Democratic primary race, WCBS also reported that Manhattan Borough President Scott Stringer edged out former New York state Gov. Eliot Spitzer to win the party's nomination to succeed Liu.

[Image via Bill de Blazio campaign Facebook page]