(CNN) For the first time in more than three decades, New York City, a national liberal stronghold that historically balks at ideological leadership inside its own narrow borders, has re-elected a Democratic mayor -- one with unabashed progressive politics and an eye on Washington.

Mayor Bill de Blasio rewrote recent history despite having operated under near constant assault from the city's boisterous tabloid newspapers, while doing little himself to smooth over sometimes testy relations with eye-rolling New Yorkers.

On Tuesday night, de Blasio pushed again for a new tax on the wealthy to help fund repairs to the city's troubled subway system, but won the most applause when he touted Democratic wins in the New Jersey and Virginia gubernatorial races.

"I bring you tidings of joy this evening, because America got a little fairer tonight, America got a little bluer tonight," de Blasio told supporters at a victory party in Brooklyn. Perhaps turning his attention to President Donald Trump, a native New Yorker, he added: "Tonight, New York City sent a message. You can't take on New York values and win, Mister President. If you turn against the values of your hometown, your hometown will fight back."

De Blasio's road here was unlikely one. He shocked the city's political elite by emerging from a crowded Democratic primary in 2013 and, with a landslide victory on Tuesday, locked up a second term after a campaign run without a serious challenge from anyone inside his own party or, in this fall's general election, city Republicans, who all but ceded the race.

For progressives in the Trump era, de Blasio's success represents new evidence to back an argument that ambitious, broad-based economic reforms -- like those put forward by Vermont Sen. Bernie Sanders, who endorsed and campaigned with the mayor last week -- can win over political skeptics and break through a wall of criticism from moderate Democrats and, in New York, the scrappiest of press corps -- a group de Blasio has made little effort to pacify.

"The tabloids are entertainment with a very small dose of news," de Blasio told CNN through a spokesman on Tuesday. "New Yorkers' political views are shaped much more dramatically by what they are feeling in their lives. They'll trust their own experience when it comes to universal pre-K, neighborhood safety, school improvement and what I'm doing to keep their apartment affordable. They strain out the entertainment when push comes to shove."

And there has been plenty of the latter -- the sideshow amusements and screeching tabloid recriminations -- during his nearly four years on the job.

"They're always going to try and find something to just blow up and make bigger, but at the end of the day, when you look at the substance of de Blasio as mayor, and you look at the policies he's enacted, he's done a great deal to make this a more equitable city," said Rebecca Katz, a former top aide and adviser. "New Yorkers don't need a mayor who is warm and fuzzy, they need a mayor who will make their lives better."

On that front, de Blasio scores high -- or even up -- with a diverse assortment of constituencies. Perhaps most surprising is the evolution of his relationship with the city's police, a fraught one that threatened to derail his mayoralty in its first year. After two officers were shot and killed while sitting in their patrol car in December 2014, hundreds of police turned their backs on de Blasio at the slain officers' memorial services.

De Blasio's open discussion of a warning he'd given his biracial son, telling him to be especially cautious if he were stopped by police, along with past criticism of controversial practices like "stop and frisk" and long-running labor angst all fed what seemed like a doomed alliance.

But those concerns, a few notable blips aside, have mostly drifted into the background. In early 2017, he agreed to a new contract with the largest police union, which had been working without one for years. As election season approached, the union chose not to make an endorsement -- which many scored as a political win for the mayor.

"Had they endorsed (Republican challenger) Nicole Malliotakis, it definitely would have been embarrassing," Christina Greer, an associate professor of political science at Fordham University, said on Monday. "But then again, he's given the police a lot. They asked for a few hundred more police, he gave them a thousand. They're supposed to do this (implicit bias) training, it hasn't begun yet. He promoted Jimmy O'Neill, who is widely respected among the rank-and-file."

In the meantime, controversial tactics like "stop and frisk" are all but gone and crime has continued to plummet. In an op-ed published this week, former police commissioner Bill Bratton called the combined work of the mayor and police a "New York City miracle."

De Blasio's most prominent political success, though, came in delivering on his most deeply progressive campaign promise from 2013, a pledge to bring universal pre-kindergarten for four-year-olds. The budget deal, struck with Democratic Gov. Andrew Cuomo, delivered nearly $350 million in funds for the program. There is talk now of expanding it to include three-year-olds.

"It's about kids," said the Working Families Party New York state director Bill Lipton, explaining the popularity of the program. "Lots of people understand that the science is on it is really solid and people support government when they believe are effective. People know the data on this. And the rollout was universally applauded. It demonstrated competence."

Greer, a past critic of the mayor, said de Blasio's delivery of pre-K scored him points across class and race lines.

"We know that it's helped working class New Yorkers, but I think it's also helped a lot of middle class New Yorkers stay in the city," she told CNN. "This helps a lot of two-income, middle class families that are making a good amount of money but might have either a new home or larger rental responsibilities or school loans" and who might otherwise have considered leaving the city for cheaper real estate.

The mechanics of the program, which by definition is "universal" and not targeted or means-tested, and its underlying ideology puts de Blasio in near political lockstep with Sanders, who appeared with him here last week.

"This mayor is leading the city in a way to bring us together to create a better life for all of our people," Sanders said during an October 30 event. "Everything that Mayor de Blasio is trying to do is exactly the opposite of what (President) Donald Trump is trying to do."

De Blasio saluted right back, holding up Sanders as a progressive icon -- one destined, as he put it, for greater glories still.

"That day is going to come and when it comes you are all going to look back and say, who started this, who started the ball rolling, who started this movement, who planted the seed who gave us the hope, who showed us the way," de Blasio said. "Ladies and gentlemen, Bernie Sanders."

Asked about his own future plans, de Blasio was predictably coy.

"I'm entirely focused on being mayor of the greatest city in the world," he said on Tuesday afternoon. He's now guaranteed four more years to enjoy himself.