Mr. Johnson, a progressive county commissioner, won over liberal voters across the city after finishing second in a first round of balloting.
In the final days of the mayoral campaign in Chicago, Brandon Johnson drew more than 4,000 people to a jubilant rally featuring Senator Bernie Sanders, who endorsed him. He crisscrossed the South and West Sides, visiting six churches in a single Sunday. In a last push on Election Day, an army of volunteers for Mr. Johnson knocked on 46,000 doors across the city, whipping up enthusiasm and encouraging last-minute voters to get to the polls.
The coalition that Mr. Johnson needed — young people, Black voters on the South and West Sides, a sizable number of Latino voters, white progressives on the North Side and along the lakefront — was coming together.
On Tuesday, Mr. Johnson, a Democratic county commissioner who was unknown to many Chicagoans a few months ago, came from behind to defeat Paul Vallas, a more conservative Democrat and a former school executive who entered the runoff campaign with a significantly larger base of support. Mr. Vallas, 69, was the favorite of many moderate and conservative voters, running on a law-and-order platform in which he promised to expand the police force and crack down on crime.
But even though large numbers of Chicagoans had said in polls that they considered public safety to be the most important issue in the election, it was Mr. Johnson, 47, who captured the slim majority of votes in Tuesday’s election. He tapped into the vast network of progressive groups in liberal Chicago — from the powerful teachers’ union to smaller, ward-based political organizations — who focused on field work to rally voters. Mr. Johnson pitched voters on a public safety plan that went beyond policing but distanced himself from past support for defunding of law enforcement.
Mr. Johnson took advantage of widespread doubts among Democratic voters over Mr. Vallas’s party identification, ever since the emergence of a television interview from 2009 in which Mr. Vallas called himself “more of a Republican than a Democrat.”
And Mr. Johnson capitalized on key endorsements to bolster his credibility among voters who did not know him well, especially those from Senator Sanders and Representative Jesús G. García, a progressive congressman with a base of support in mostly Hispanic neighborhoods on the West Side.
“You walk into a runoff with a certain base, but then you’ve got to expand your base beyond that,” Andre Vasquez, a City Council member who organized for Mr. Johnson, said on Wednesday. “The Latino community did better for Brandon than expected. The North Side performed well.