Martha Coakley captured the Democratic gubernatorial nomination Tuesday in an unnervingly close primary victory over Steve Grossman, on a day that saw restless Democratic voters oust a nine-term congressman and overwhelmingly reject a veteran politico in favor of a newcomer for attorney general.
Coakley, determined to banish lingering doubts from her disastrous 2010 Senate run and become the first woman elected governor in the state, squeezed by Grossman by 6 percentage points, far less than polls and party leaders had predicted.
The slim margin will inevitably reinforce questions among Democratic Party officials, activists, and fund-raisers about Coakley’s ability to win the general election in November. She will face a grinding race against Republican nominee Charlie Baker, who handily won his primary over a Tea Party Republican.
The night’s most shocking result came in the Sixth District, where an 18-year veteran of the US House, Democrat John F. Tierney, lost a heated primary battle to Seth Moulton, an Iraq war veteran who capitalized on voter disgust with Congressional inaction.
In another victory for a political outsider running against the establishment, Maura Healey, a newcomer to politics, became the Democratic nominee for attorney general by trouncing longtime party favorite Warren Tolman, who had the support of labor leaders as well as Governor Deval Patrick and Mayor Martin J. Walsh. Tierney, too, enjoyed the support of party insiders, including most of his House colleagues and the state’s two US senators, Elizabeth Warren and Edward J. Markey.
The victories by Coakley and Healey, along with wins by Deborah Goldberg in the competitive Democratic primary for state treasurer and incumbent Suzanne Bump in an uncontested primary for state auditor, lay the groundwork for a November election that could send a slate of women to male-dominated Beacon Hill.
In the Democratic race for lieutenant governor, Steve Kerrigan easily defeated two challengers and will run on a ticket with Coakley. She won with 42 percent of the vote to 36 percent for Grossman and 21 percent for Donald Berwick, with nearly all precincts reporting.
Baker, who is trying to remake his political profile after a poor showing as the 2010 Republican nominee for governor, coasted to victory in the GOP primary, with 74 percent of the vote to 25 percent for Mark Fisher.
Coakley, 61, and Baker, 57, will now battle for the hearts and minds of moderate Democrats and independents who traditionally swing Massachusetts elections.
At her victory party at the Fairmont Copley Plaza on Tuesday night, Coakley promised to fight for early childhood education, for equal pay for women, and for a “fair shot” for workers.
She also embraced her defeat in the 2010 US Senate race.
“I’ve been weathered. I’m tough. I come back and fight again another day,” she said. “I did that tonight and I’m going to continue to stand up for people who need a voice here in Massachusetts.”
Baker, hoping to appeal to urban Democrats, held his celebration at Venezia Restaurant in Dorchester, and was introduced by Robert Lewis Jr., an African-American activist who served in the administration of Mayor Thomas M. Menino.
Baker positioned himself as an independent who could forge compromise in a state government dominated by Democrats.
“We want to bring a new, independent brand of bipartisan leadership,” Baker declared. Afterward, he told reporters: “This one-party stuff, it’s not accountable. It’s not transparent."
Like independents and moderates, women, who have comprised an increasing majority of voters in recent statewide races, will be heavily courted by both candidates in the general election. Coakley, who has cast herself in her ads as an antidote to the “old boys’ club” on Beacon Hill, plans to tout the history-making potential of her candidacy.
Baker, who lost the women’s vote by 24 points when he ran in 2010, has been leaning on his running mate, Karyn Polito, and his wife, Lauren, to help him avoid a similar drubbing in November. He has also emphasized his support for abortion rights and insurance coverage for contraceptives, stances that aides say set him apart from the social conservatives who dominate his party nationally.
The battle between Baker and Coakley is expected to turn on boilerplate partisan differences. Baker promises to hold the line on spending and taxes, and streamline state government. A former health insurance executive who worked in the Weld and Cellucci administrations, he plans to run as a business-friendly executive attuned to the needs of employers and ready to create jobs.
Coakley plans to emphasize her support for women, workers, and those who depend on government services, such as the mentally ill. She will rely on backing from traditional forces in the party, including labor unions, women’s and gay rights groups, and environmentalists.
Both candidates were the heavy favorites in their primaries. Baker, although a moderate, was able to mollify much of the restive conservative wing of his party.
The Democratic race, meanwhile, was plagued by a lack of passion from voters accustomed to charismatic candidates like Patrick and Warren, who stirred excitement, raised huge amounts of money, and built large, sophisticated grass-roots field organizations.
In the months leading up to Tuesday’s primary, Coakley maintained a large lead in the polls and a high favorability rating, despite negative ads aired by Grossman supporters and sharp criticism from her rivals who said she lacked vision and boldness.
Unlike her 2010 US Senate race, Coakley brought together a seasoned political team that helped engineer the Patrick and Warren campaigns. She also worked to elevate her campaign skills, trying to shed her image as stiff and aloof by crisscrossing the state to greet voters.
Grossman, 68, a former chairman of the state and national Democratic Parties, drew heavily on his support from fellow elected officials and longtime party insiders. That network, which has a cool relationship with Coakley, helped him win the Democratic convention endorsement in June. But he struggled to translate his convention that victory into broader support among the Democratic electorate.
“We may have fallen short by 5 percentage points, but we didn’t fall short,” Grossman told his supporters Tuesday night. “We created an energized army of activists and stakeholders who collectively did so much to make this campaign as competitive as it is — and was.”
Berwick, who turned 68 on Tuesday, entered the contest hoping to ignite the kind of grass-roots enthusiasm for a political outsider that propelled Patrick and Warren into office.
But in the town-by-town proving ground of the campaign, he could not make the leap from global expert in health care to galvanizing candidate. Nevertheless, he told his supporters Tuesday night that he was proud of his better-than-expected finish.
“Our results are frankly good enough we’re going to leave plenty of pollsters and pundits scratching their heads,” he said, as 200 people applauded and called out his name.
The Republicans running for other statewide offices — Polito, Baker’s running mate and choice for lieutenant governor; John B. Miller for attorney general; David D’Arcangelo for secretary of state, Michael J. Heffernan for treasurer; and Patricia S. Saint Aubin for auditor — were running unopposed in their primaries.
Akilah Johnson, Nestor Ramos, Andrew Ryan, and Eric Moskowitz of the Globe Staff contributed to this report. Michael Levenson can be reached at email@example.com.