New York City Mayor Bill de Blasio (D) gives a thumbs-up after casting his vote in the Park Slope section of Brooklyn on Tuesday. (Brendan Mcdermid/Reuters)

New York Mayor Bill de Blasio easily won a second term on Tuesday, the Associated Press has projected, capitalizing on economic growth, low crime and a weakened Republican Party in a race he turned into a referendum on progressive government.

The incumbent Democrat handily defeated Republican Nicole Malliotakis, a member of the state assembly, and a smattering of independent and third-party candidates. With 90 percent of precincts reporting, de Blasio had won 65.3 percent of the vote to 28.9 percent for Malliotakis.

"We have so much to be proud of over these last four years," de Blasio told supporters in his victory speech at the Brooklyn Museum. "But we can't stop now."

De Blasio first won election in 2013, when he broke a 20-year Republican grip on City Hall by running on populist housing policy and criminal-justice reform. In the run-up to Tuesday, de Blasio's opponents and the New York media attacked him over a donor's claim that he got special treatment. The New York Daily News, which endorsed the mayor in 2013, withheld support this year over his "blinkered, often sanctimonious governance."

His victory Tuesday made de Blasio the first Democrat since Ed Koch to be returned to City Hall for a second term, and he was rewarded for a campaign in which he ran sharply to the left — and sharply against President Trump (R).

De Blasio told voters that the city was nearly halfway to his goal of building 200,000 new units of affordable housing by 2026, then increased that promise by a third. He challenged critics who had warned incorrectly that ending the "stop and frisk" policing policy, criticized for disproportionately affecting black New Yorkers, would lead to more crime. His campaign motto, "It's your city," was sometimes folded into an attack on the president's agenda.

New York City Mayor Bill de Blasio greets people at the 72nd Street subway stop on the Upper West Side of New York Tuesday. (Timothy A. Clary/AFP/Getty Images)

"If you don't like what you see in Washington, send a message to Washington with your vote on Tuesday," de Blasio told a Brooklyn church congregation at one of his last campaign stops. "This city has challenged Donald Trump since the very beginning."

Progressives, hungry for wins this year, celebrated the de Blasio victory as one of their own. Sen. Bernie Sanders (I-Vt.) endorsed the mayor and stumped with him in the final week to support the idea of a new tax on the very wealthy.

"Everything that Mayor de Blasio is trying to do is exactly the opposite of what Donald Trump is trying to do," Sanders said at a pre-election rally.

Trump, a New York City voter, cast an absentee ballot before heading on a 12-day tour of Asia. The White House did not say whom he voted for.