State Representative Martin J. Walsh and Councilor John R. Connolly emerged Tuesday atop a crowded field vying to become Boston’s next mayor, propelled by well-funded campaigns that outmuscled and outorganized the competition.
With all precincts counted, Walsh finished first in the preliminary election with 18.5 percent of the vote, and Connolly closely followed, at 17.2 percent. They beat 10 other candidates to advance to the Nov. 5 final election.
“I’m ecstatic,” Walsh said, citing the hard work of the volunteers on his campaign. “I’m also grateful for the other candidates in the race. I’ve talked to most of them. They are great people. They are great public servants. They were difficult phone calls. They love this city.”
At a time when Boston is increasingly diverse, Tuesday’s results mean that the city’s next mayor will be a white man of Irish heritage, extending a three-decade run during which a candidate of color has failed to make it to the mayoral final.
But neither Walsh, who speaks often of his support of programs helping women and minorities and his vote in favor of gay marriage, nor Connolly, who has staked a political career on education reform, fits neatly into the preassigned box of the old-school Irish pol.
Former city housing chief Charlotte Golar Richie, the only woman in a field of 12, finished third with 13.8 percent. Suffolk District Attorney Daniel F. Conley was fourth, at 11.3 percent.
Four candidates — City Councilor Felix G. Arroyo, political newcomer John F. Barros, City Councilor Rob Consalvo, and City Councilor Michael P. Ross — were tightly bunched, with between 7.2 and 8.8 percent of the vote. Turnout was relatively low, with 113,222 ballots cast, representing 31 percent of the city’s registered voters.
Connolly held a victory rally at Hibernian Hall in Roxbury, telling an enthusiastic audience that he has never been “more thankful to be in second place.” The setting for the celebration in the heart of Boston’s black community was a strategic choice as the race pivots to the final election.
“Our campaign looks like the face of the city of Boston. I’m no stranger to this hall,” Connolly said. “I drop my daughter off for school every day less than a mile from here. We have, and will continue to run, a citywide campaign.”
With Walsh and Connolly in the final, the race to succeed five-term incumbent Mayor Thomas M. Menino shapes up as a clash between the State House and City Hall. It pits Walsh, the son of Irish immigrants who decades ago was grazed by a bullet on a dark Dorchester street, against Connolly, a Harvard-educated native of Boston’s leafy parkways.
It features one campaign bolstered by the might and money of labor, and another resolutely focused on fixing city schools.
The madcap preliminary race for mayor gives way to a final election that could ignite interest among an electorate that has shown scant interest. The campaign will leave behind the exploits of a dozen voices clamoring, albeit civilly, to be heard above the chaos at myriad candidate forums.
The 46-year-old Walsh and Connolly, 40, will now be the only two on stage. They are two candidates with different styles: One is an exuberant union official, and the other is a methodical attorney. Voters will hear two distinct sets of ideas. And ultimately, the electorate will choose between competing visions for Boston’s future.
Walsh topped the ticket with an army of volunteers, many of whom came from the ranks of labor. A nine-term state representative from Dorchester, Walsh served as both an elected official and a labor executive. His father and uncle were leaders of Laborers Local 223, and Walsh joined at age 21 and became a benefits officer.
After being elected to the Legislature in 1997, Walsh became president of Local 223. He rose to lead the Boston Building Trades, an umbrella group that represents unions of ironworkers, electricians, and others. Walsh resigned the building trades post to run for mayor, but organized labor formed the bedrock of his campaign.
By Sept. 15, almost $2 million had been spent on behalf of Walsh, a figure that exceeded what any other candidates spent.
That included almost $1.3 million from Walsh’s campaign, which received $385,000 in direct contributions from labor unions and political committees. Under state law, unions can give up to $15,000, far beyond the $500 limit for individuals. Firefighters unions alone gave Walsh $46,500.
Outside groups affiliated with or funded by organized labor spent another $700,000, running television advertisements and sending canvassers door to door.
But Walsh extended his campaign beyond labor. He is a recovering alcoholic, and some of his most avid supporters are people in the recovery community.
Connolly’s campaign was animated by the candidate’s call for fixing Boston’s schools. As a city councilor, he organized parents of schoolchildren, giving him an army of mothers who have served as foot soldiers in his bid to become mayor.
Perhaps most important, Connolly became the only candidate to dare to challenge a five-term incumbent, launching his campaign in February before Menino declared he would not seek reelection.
The mayor announced his retirement at the end of March, but Connolly had a significant headstart raising money and building a robust political operation.
Ultimately, a dozen candidates qualified for the race. The sixth-month sprint proved especially difficult for candidates not in elected office.
There was simply not enough time to raise money and build an organization.
Connolly’s campaign had spent almost $1.2 million by Sept. 15, the third most in a race with wide disparities in fund-raising. An education reform group spent $64,000 more on Connolly’s behalf, but ceased its efforts in August at the candidate’s request.
Controversy briefly ensnared Connolly when a separate education group promised to spend $500,000 to help elect him.
Connolly accepted the group’s endorsement, but then asked them and all other outside groups not to spend money on his behalf.
Walsh also began quietly laying groundwork for a run for mayor — raising money and building a formidable campaign — before Menino announced he would not seek another term.
Menino’s decision unleashed two decades of pent-up political ambition. Two dozen candidates initially pulled papers to run for mayor, and 12 qualified for the ballot.
The city’s political circles buzzed through the summer, but Boston’s broader electorate seemed apathetic. The city has faced 20 separate elections since 2010. And the sheer number of candidates in the mayor’s race proved daunting to some voters.
But for some elected officials, this was their chance. Conley jumped into the race with $868,000, a war chest he had amassed running unopposed for a decade as district attorney. He raised $900,000 more and spent heavily on television advertising. But Conley fell short.
Arroyo gave up his seat on the City Council after two terms and became the first Latino in Boston ever to appear on the ballot for mayor. But Arroyo struggled to raise money and lost several key union endorsements to Walsh.
Consalvo spent a decade on the City Council and never hid his ambition to succeed Menino, his Hyde Park neighbor and friend. Consalvo’s campaign had trouble extending beyond Hyde Park and the city’s other Italian enclaves.
Ross also gave up his seat on the council and ran a campaign targeting hip urbanites. He raised almost $800,000 and spent heavily on television, which included a notable ad that had him running through the city.
Golar Richie was the last major candidate to jump into the race and her campaign never really hit its stride, struggling to raise money. She was the only woman on the ballot with 11 men, presumed to be an advantage with an electorate that has more women than men.
Barros is a political newcomer who significantly raised his profile during the campaign. He was the first person of Cape Verdean descent to run for mayor.
Bill Walczak, cofounder of a Dorchester health center, was also a first-time candidate. He made his opposition to a proposed casino at Suffolk Downs a centerpiece of his campaign.
In the end, only Connolly and Walsh will advance to the final.
It will look like a return to old Boston, when men of Celtic ancestry ruled City Hall for more than half a century. It was Menino, the self-styled urban mechanic, who blazed a trail when he took office in 1993, becoming the first Italian-American to occupy the mayor’s fifth-floor office at City Hall.
The stewardship of the city now will pass to a new generation. Both finalists are younger than Menino when he took office. The men battling to become Boston’s 48th mayor will replace someone who will be 71 when he leaves the post.
“We are stepping into a new era,” Walsh told a crowd Tuesday night at Venezia in Dorchester over chants of “Mar-ty! Mar-ty! “We recognize the next 20 years will be different from the last. New problems. New opportunities. New challenges. The vote we cast on November 5th must be about the new direction our city will take.”Andrew Ryan can be reached at firstname.lastname@example.org. Wesley Lowery and Joshua Miller of the Globe staff contributed to this report. Andrew Ryan can be reached at email@example.com. Wesley Lowery and Joshua Miller of the Globe staff contributed to this report.