Both Marty Walsh and John Connolly came out September’s preliminary mayoral contest with enormous work to do in Boston’s communities of color. Walsh edged past Connolly in Tuesday’s mayoral election largely because he captured a disproportionate share of votes in majority-minority precincts, piling up large enough margins to withstand a strong push by Connolly in Boston’s more affluent downtown neighborhoods.

CommonWealth detailed the steep climb facing both mayoral candidates in Boston’s communities of color last month. Walsh and Connolly exited September’s preliminary contest with solid bases of geographic support in the city’s eastern and western edges, but both politicians struggled enormously in the city’s geographic center in September. Connolly and Walsh combined to win just 19 of the city’s 112 majority-minority precincts in the preliminary contest. Both collected votes in majority-minority precincts at roughly half the rate they did in majority-white precincts.

Walsh and Connolly spent the weeks following September’s preliminary scrambling to claim votes that had gone to Charlotte Golar Richie, John Barros, Felix Arroyo, and Rob Consalvo. Walsh quickly won the backing of Richie, Barros and Arroyo, and followed those endorsements with endorsement press conferences featuring the likes of state Sen. Linda Dorcena Forry, Rep. Carlos Henriquez, city councilor Tito Jackson, and Mel King, a mayoral finalist in 1983. Aside from the 11th-hour endorsement Connolly received from former mayoral candidate Charles Clemons, Walsh received the backing of every politician of color who endorsed in the race. Connolly largely relied on the backing of ministers in Dorchester, Roxbury, and Mattapan.

Walsh’s coalition of labor union backers, white neighborhood progressives, and black and Hispanic supporters carried him past Connolly on election day. Walsh’s support in Boston’s minority communities proved to be especially important. The Dorchester lawmaker topped Connolly by roughly 3.5 percentage points, or 4,900 votes. Walsh lost whites by a solid 6,000-vote margin, though. He will occupy City Hall because he posted an 11,000-vote, 20-point drubbing on Connolly in majority-minority precincts. (Click here for an interactive, precinct-by-precinct map of results from Boston’s mayoral final.)

Walsh took 101 of Boston’s 112 majority-minority precincts. He did it in convincing fashion, posting a median winning margin of 22 percentage points over Connolly. Connolly won just 11 majority-minority precincts, largely in East Boston, Chinatown, and the South End. When he did win majority-minority precincts, he didn’t win with nearly the wide margins that Walsh posted. Connolly also ceded three East Boston precincts he’d won in September to Walsh. (Click here for an interactive map detailing Walsh and Connolly’s performance in majority-minority precincts, here for a map illustrating winners in precincts Arroyo, Barros, and Richie won in September, and here for a map detailing voting patterns in majority-white precincts.)

Overall, Walsh won majority-minority precincts by 20 percentage points. That margin proved decisive, as Walsh lost majority-white precincts to Connolly by 11 points – largely thanks to a wave of votes in Boston’s affluent, largely white northern section.

Voters in Beacon Hill, the West End, the South End, and the Back Bay turned out in stronger-than-usual numbers for the mayoral election. Connolly routinely hung margins of 50- to 70-percentage points on Walsh downtown. Overall, Connolly won 95 majority-white precincts, to Walsh’s 47 precincts. Majority-white precincts cast 62 percent of the ballots in Boston’s mayoral race, and Connolly won 53 percent of them. He still finished 3.5 percentage points behind Walsh, thanks to the lopsided losses he suffered in Dorchester, Roxbury, Mattapan, and Hyde Park.