Backed by a formidable army of volunteers, state Rep. Marty Walsh opened up a lead of more than 4,908 votes to beat City Councilor John Connolly, winning the mayor’s seat with 72,524 votes.

As volunteers packed the main ballroom at the Park Plaza Hotel, Walsh pledged to unite a city that split nearly evenly between the two mayoral candidates.

“This is Boston strong, and together we’re going to make Boston even stronger,” he said. “We’re going to do it by expanding opportunity, we’re going to do it by creating community and creating equality for everyone.”

Walsh’s victory capped a feverish six-week battle with Connolly’s campaign that saw what many say was an unprecedented push for the support of the black, Latino and Asian communities.

“This is the first time we saw candidates going after both the minority vote and the minority leadership,” said Walsh supporter Alvaro Lima, director of research at the Boston Redevelopment Authority. “The endorsements were very important. For the first time, the minority community came together and made a difference.”

While a group of black clergy endorsed Connolly, Walsh won the endorsements of all black elected officials as well as labor leaders and community organizations in the black, Latino and Asian communities.

Along with their endorsements, former mayoral candidates Charlotte Golar Richie, Felix G. Arroyo and John Barros went to work for Walsh, converting their offices to Walsh campaign offices and calling their former supporters to urge them to vote for Walsh. The efforts of the candidates were augmented by armies of union volunteers who blanketed the city’s low-voting wards with leaflets, phone calls and house visits as part of a comprehensive get-out-the-vote effort.

While the Walsh campaign was criticized for its heavy reliance on organized labor, Veronica Turner, executive vice president at SEIU 1199, said the labor support was representative of the neighborhoods of Boston.

“Labor are the folks who live in the community,” she said. “There’s no negative association. Labor is the mothers, fathers, aunts, people on public assistance – the people in the community.”

Walsh, a former leader of the Laborers Union and president of the Boston building trades organization, appealed to many with his working class roots. His victory was in many ways a repudiation of the city’s moneyed interests, which coalesced around Connolly.

The race veered into class warfare when a union-backed organization distributed flyers stating that Connolly was a “child of privilege.” While Walsh disavowed the negative campaigning and publicly asked outside groups to refrain from defamation, many of his supporters sounded class-themes during interviews in the Park Plaza ballroom.

“Walsh’s victory is a major defeat for the establishment,” said Calvin Feliciano, who works for SEIU Local 509. “Connolly got the high-powered help and Walsh got the grassroots.”

Although his Dorchester electoral base is worlds away from Roxbury, Walsh’s appeal cut deep into the black community, where unions like SEIU and Unite Here have been expanding their ranks, pulling in janitors, security guards and hotel workers.

“Most of the people who live in our community are working class families,” said Aaron Jones, a political activist and former member of the Laborers Union. “Marty speaks to working class issues.”

In his victory speech, Walsh said he plans to bring equity to Boston’s neighborhoods, pledging to close the achievement gap between white students and students of color, provide universal kindergarten, support small businesses and work for safer streets.

“Marty Walsh will be a champion of working people,” said former mayoral candidate Charlotte Golar Richie. “When the tide rises, all boats will rise.”