Former federal prosecutor Lori Lightfoot easily won the Chicago mayor's race Tuesday, earning support from every part of the city to defeat a longtime political insider and become the first black woman and openly gay person to lead the nation's third-largest city.

Lightfoot, who had never been elected to public office, delivered a commanding victory over Toni Preckwinkle, who served in the City Council for 19 years before becoming Cook County Board president. Preckwinkle also is chairwoman of the county Democratic Party.

Lightfoot promised to rid City Hall of corruption and help low-income and working-class people she said had been "left behind and ignored" by Chicago's political ruling class. It was a message that resonated with voters weary of political scandal and insider deals, and who said the city's leaders for too long have invested in downtown at the expense of neighborhoods.

"Together we can and will make Chicago a place where your zip code doesn't determine your destiny," Lightfoot told a cheering crowd at her victory party. "We can and we will break this city's endless cycle of corruption and never again — never ever — allow politicians to profit from elected positions."

She said people are seeing "a city reborn" — a place where race and "who you love" don't matter.

Lightfoot had emerged as the surprising leader in the first round of voting in February when 14 candidates were on the ballot to succeed Mayor Rahm Emanuel, who decided against running for a third term.

Chicago will become the largest U.S. city to elect a black woman as mayor when Lightfoot is sworn in May 20. She will join seven other black women currently serving as mayors in major U.S. cities, including Atlanta and New Orleans.

The vote to succeed Emanuel came just days after Chicago state prosecutors stunned the nation by opting to drop charges against actor Jussie Smollett, who was accused of faking a hate-crime attack that implicated supporters of President Trump.

Prosecutors have said they did not intend to vindicate Smollett, but the actor publicly claimed exoneration -- leading comedians to mock him, and police unions and the mayor's office to cry foul.

Lightfoot seized on outrage over the deadly shooting of black teenager Laquan McDonald -- at the hands of white officer Jason Van Dyke -- to launch her campaign. That was even before Emanuel announced he wouldn't seek a third term amid criticism for initially resisting calls to release video of the shooting.

WHY WAS OBAMA CHIEF OF STAFF REACHING OUT TO SMOLLETT PROSECUTOR?

"I'm not a person who decided I would climb the ladder of a corrupt political party," Lightfoot said during a debate last month. "I don't hold the title of committeeman, central committeeman, boss of the party."

That was a not-so-veiled reference to Preckwinkle, who also leads the county's Democratic Party and had countered that her opponent lacked the necessary experience for the job.

"This is not an entry-level job," Preckwinkle said repeatedly during the campaign. "It's easy to talk about change. It's hard to actually do it. And that's been my experience — being a change maker, a change agent, transforming institutions and communities."

Joyce Ross, 64, a certified nursing assistant living on the West Side, said she cast her ballot Tuesday for Lightfoot. Ross also said she believed Lightfoot would be better able to clean up the police department and curb the city's violence.

DRIVE-BY SHOOTING SULLIES MOOD IN CHICAGO, AFTER RELATIVELY GOOD MONTH OF ONLY 20 HOMICIDES

In addition, she said she was bothered by Preckwinkle's association with longtime Alderman Ed Burke, who was indicted earlier this year on charges he tried to shake down a restaurant owner who wanted to build in his ward.

"My momma always said birds of a feather flock together," Ross said.

The campaign between the two women got off to a contentious start, with Preckwinkle's advertising focusing on Lightfoot's work as a partner at Mayer Brown, one of the nation's largest law firms, and tagging her as a "wealthy corporate lawyer."

Preckwinkle also tried to cast Lightfoot as an insider for working in police oversight posts under Emanuel and police oversight, procurement and emergency communications posts under former Mayor Richard M. Daley.

In one ad, Preckwinkle criticized Lightfoot's oversight of emergency communications in 2004 when a fire killed four children. A judge ordered Lightfoot to preserve 911 tapes after questions were raised about how the emergency call was handled. The ad noted some of the tapes were destroyed, prompting the judge to rebuke Lightfoot. The ad sparked a backlash from the family of three of the children killed, with their sister accusing Preckwinkle of trying to take advantage of her family's tragedy.

WATCH: DUELING RALLIES OVER SMOLLETT ENGULF CHICAGO

Lightfoot also responded by scolding her opponent for being negative while also airing ads pointing out Preckwinkle's connection to powerful local Democrats, including one under federal indictment.

Preckwinkle spent much of her time during the campaign answering for her ties to Chicago's political establishment. She and her supporters asserted her rise to Democratic Party leadership did not hinder her ability to oppose policies promoted by the city's ever-powerful mayors.

"My whole career has been about change, and change is action and results, not simply words," said Preckwinkle, who said her experience made her better positioned to lead a city with financial problems and poorer neighborhoods hit by gun violence.

Despite the barbs on the campaign trail, the two advanced similar ideas to boost the city's finances.

Both candidates expressed support for a casino in Chicago and for changing the state's income tax system to a graduated tax, in which higher earners would be taxed at a higher rate.

Preckwinkle said that while downtown development should remain a priority, it should not be at the cost of neighborhood growth. She promoted additional investments in neighborhood schools, affordable housing and criminal justice reform.

CLICK TO GET THE FOX NEWS APP

Lightfoot said that as mayor, she would focus on investing in neighborhoods on the West and South Sides and bring transparency and accountability to City Hall. She added she also wanted to end City Hall corruption and restore people's faith in government.

"The machine's been in decline for a while, but it still has a grip on certain things," Lightfoot said. "This is our opportunity to send it to its grave, once and for all."

Fox News' Andrew O'Reilly and The Associated Press contributed to this report.