James Warren, former managing editor of the Chicago Tribune, is executive editor of NewsGuard, which rates the credibility of news sites.

CHICAGO — When a beaming Lori Lightfoot was overwhelmingly elected Chicago’s first openly gay and first black female mayor late Tuesday, she derided the city’s “endless cycle of corruption,” promised to make its streets safe and sharply asserted, “it doesn’t matter who you love, just as long as you love.”

If she radiated buoyant and defiant optimism, a skeptic might recall the final scene in “The Candidate” when dashing neophyte Bill McKay (Robert Redford) wins an upset U.S. Senate race, then turns to his campaign manager (Peter Boyle) and asks, “What do we do now?”

Having ducked fundamental questions during her brave and historic campaign, Lightfoot, a corporate lawyer and onetime federal prosecutor with no elective experience, faces a colossal task in bringing financial stability, reducing crime and easing complex racial tensions in the nation’s third-largest city. “We can and will make Chicago,” she said, “a place where your Zip code doesn’t determine your destiny.”

“I would say ‘Congratulations,' ” said Lawrence Msall, a fiscal expert who is president of the nonprofit Civic Federation, about the new mayor who was on the victory platform by her wife and 10-year-old daughter. “’You are now in charge of a government with a very high risk of financially faltering.”

She faces a $500 million budget deficit and must find $1 billion of new revenue (i.e. taxes) or cuts to meet impending pension payments. She succeeds the maniacally intense Rahm Emanuel, who deactivated financial land mines, improved schools, invested in infrastructure and spurred development, but also raised every tax, fine and fee (garbage, sewer, water, you name it) he could before opting not to run for a third term amid declining popularity.

Lightfoot’s victory was a swift as it was unlikely. Just two months after finding herself in ninth place in a 15-candidate primary field, she rode both a wave of anti-incumbent fervor stoked by new revelations of municipal corruption and Rahm Fatigue, partly reflecting his fumbling race and police issues. In an election in which neither her race nor sexual orientation were seeming issues, she got into a runoff with just 17 percent of the vote and then upended another black woman, onetime odds-on favorite and Cook County Board President Toni Preckwinkle.

Lightfoot, 56, deftly positioned herself as a sober change agent, using her inexperience as a plus and benefiting from the implosion of key rivals, federal corruption charges against the most influential City Council member, and low voter turnout. She had announced her candidacy as a virtual unknown before Emanuel revealed he was exiting, unlike most others who were antsy about even taking on a wounded incumbent.

Lightfoot’s personal saga is an admirable rise from hardscrabble, segregated Massillon, Ohio (a “racist” steel town, she called it in victory), and a career of solid, if not dazzling, achievement. She’ll lead a city with declining population, a bond rating below junk, a sky-high though declining crime rate, awful race relations, frequent police misconduct, and shameful poverty a short hop from a glittering and cosmopolitan downtown.

“She’ll have a sharp learning curve,” says David Axelrod, the political consultant and key strategist in the rise of hometown hero Barack Obama.

In an anti-incumbent season, as other municipal races confirmed Tuesday, Lightfoot will confront a newly empowered City Council. Long a rubber stamp for power-savvy practitioners such as Emanuel, it now will feature independent, left-leaning newbies, as many compromising veterans were booted.

As Axelrod notes, Chicago government is designed as a strong-council/weak-mayor system. Still, except for a brief period three decades ago, mayors control the council with carrots and sticks. But, “There are fewer of each available these days and, presumably, less interest on the part of the new council to play ball,” says Axelrod. Emanuel won eight years ago with a glittering résumé, having operated at the highest levels of government and politics. Panache and a prodigious Rolodex coaxed many companies like Kraft Heinz, McDonald’s and United Airlines to move headquarters to the city, and he oversaw a surge in tech employment. His energy is inexhaustible, his ability to project empathy limited.

Can Lightfoot rise to the task, finding high-quality aides, and think both local and global? Lame-duck Emanuel is in self-promotional overdrive, just ramming through a $6 billion commercial-residential project for the prosperous North Side, and then announcing a $8.5 billion international terminal expansion at O’Hare Airport. Lightfoot might surpass him in exhibiting heart but will strain to eclipse his business-friendly grandiosity.

As Lightfoot inherits a complex mess in a city of 2.7 million, the question “What do we do now?” probably has one simple answer: Somehow, in some way, she must translate her background and audacity into the messy scrum of big-city politics in an age of scarcity.

How will she fulfill her promise to end gun violence? And, where, oh where, will she find all that money? She’ll only say she plans to hold “a conversation” with citizens and figure out solutions. Let the talking begin.