He pledged to remake New York’s social fabric, stoked the hopes of discouraged liberals and vowed that a city defined by its luxuries would once again be a comfortable home for those with money struggles and the poor.

Now comes the hard part.

After a sweeping victory fueled by lofty ideological promises and happy family portraits, Mayor-elect Bill de Blasio woke up on Wednesday to a crueler reality: a $2 billion hole in the next city budget, a dysfunctional state legislature skeptical about his tax plan, a police department frozen by a federal lawsuit and municipal unions clamoring for raises.

Mr. de Blasio, an untested manager with virtually no executive experience, will have to navigate this municipal minefield — and keep crime low, and avoid big gaffes — as he tries to placate an energized electorate expecting big results.

“Having encouraged people to think of a city that is closer and closer to their notion of justice and fairness, Bill must explain that a mayor can’t wave a magic wand and bring about the changes they want,” said Kenneth Sherrill, professor emeritus of political science at Hunter College.