Lori Lightfoot during the election night party in Chicago, Illinois. (AFP)

In a historic first, a gay African-American woman was elected mayor of America's third largest city Tuesday, as Chicago voters entrusted a political novice with tackling difficult problems of economic inequality and gun violence.

Lori Lightfoot, a 56-year-old former federal prosecutor and practicing lawyer who has never before held elected office, won the Midwestern city's mayoral race in a lopsided victory.

She beat out Toni Preckwinkle, the chief executive of Cook County in which Chicago is located, by a wide margin of 74 to 26 percent in early voting results with most ballots counted. Preckwinkle is also African-American.

Lightfoot will become Chicago's first openly gay mayor and the first African-American woman to hold the post. Since 1837, Chicago voters have elected only one black mayor and one female mayor.

Her ascendancy to the top of Chicago government was a stunning development in a city where insider deals and entrenched party politics held sway for decades.

"It is a city-wide rejection of the Chicago political establishment at the mayoral level," Evan McKenzie, political science professor at the University of Illinois in Chicago, told AFP.

Preckwinkle has for decades held various local elected offices, which analysts said hurt her in an election in which voters were looking to shake up city hall -- fed up with gun violence that claims more lives than in other major American cities, and years of political corruption in the Democratic stronghold.

"People (are) hoping for something different to come along. To be the vessel for that is overwhelming," Lightfoot told reporters earlier Tuesday.

The initial field in the mayoral race consisted of 14 contenders, but Lightfoot managed an upset -- sidelining moderates and establishment figures by promising to clean up city government and reduce economic inequality.

She and Preckwinkle were the final two left competing in Tuesday's run-off election.

Lightfoot headed a panel investigating the city's policing problems and held a number of appointed positions in city government.

She has promised to increase affordable housing, fight homelessness and crime, and boost oversight of the police department.

"New ideas"

Voters left little doubt they wanted the next mayor to tackle the major issues vexing the city of 2.7 million people -- including economic disparities and gun violence.

"The message is that (voters) want new ideas and cleaner government," McKenzie said.

Community groups have for years complained about disparities in living conditions among the sprawling city's diverse communities.

Gun violence, fueled by gangs and the drug trade, plagues economically-depressed neighborhoods in the South and West, which are majority African-American.

The downtown business district, and areas to the north and along the city's famed lake shore, have enjoyed an economic boom even as more than 550 people were murdered last year alone.

Reforming the police department, which has a sordid history of abusive tactics, and city hall, which is mired in a federal corruption probe of one of its members, are also top priorities, McKenzie said.

Laquan McDonald

Lightfoot will replace outgoing mayor Rahm Emanuel -- once a rising star in the Democratic Party and former president Barack Obama's first White House chief of staff.

The powerful Emanuel sustained political damage for his handling of murder of black teenager Laquan McDonald and declined to run for a third term.

Lightfoot emphasized during her campaign that she was among the few early candidates to declare her candidacy before Emanuel decided not to run again.

McDonald was a 17-year-old boy shot dead by police in a 2014 encounter caught on police dash cam video.

The video -- showing officer Jason Van Dyke firing 16 bullets into the knife-wielding teen even after he fell to the ground -- was not released for more than a year.

Emanuel faced accusations of an attempted cover-up. He fired the police chief and brought in a reformer who has instituted changes, worked to rebuild public trust, and reduced gun violence.

But as Van Dyke was about to go on trial for murder in September, Emanuel announced he would not run for re-election.

Van Dyke was convicted and sentenced to nearly seven years in prison.