WORCESTER — In a major upset that reflects a generational challenge to the party establishment, Democratic activists on Saturday snubbed longtime Secretary of State William F. Galvin and endorsed his 34-year-old rival, Boston City Councilor Josh Zakim.
Zakim topped Galvin with 55 percent of the delegates' votes at the party's state convention in the DCU Center in Worcester, meaning both will make the Sept. 4 primary ballot, but Zakim has gotten a boost in credibility as he seeks to end Galvin's six-term run.
Delegates also gave a strong endorsement for governor to a first-time candidate, one-time state budget chief Jay Gonzalez, who garnered nearly 70 percent of the vote to soundly defeat environmental activist Robert K. Massie.
Advertisement
Massie — who was the party's lieutenant governor nominee in 1994, the same year Galvin first won his office — earned just over 30 percent of the vote, ensuring he also cleared the 15 percent hurdle needed to stay on the ballot.
But the vote for Zakim was a surprising turn in the race for the low-profile but critical office, where Galvin has faced few serious challenges in more than two decades.
Galvin drew 45 percent of the vote at this year's convention, which drew an influx of first-time delegates, many of whom are younger party activists incensed over Donald Trump's presidency.
"That's a significant margin," Zakim said of his win. "I take this as a great moment at the beginning of a campaign. . . . We have different ideas about some of the core functions of this office."
Not since 1982, when Michael Dukakis roundly defeated then-governor Edward J. King, has a statewide Democratic incumbent been rejected by party activists at the convention.
"What we saw today here is a new generation of leadership,'' said 44-year-old Quentin Palfrey, another first-time candidate and former Obama administration adviser, after he decisively beat 63-year-old veteran comic Jimmy Tingle, 59-41 percent, as the party's endorsed candidate for lieutenant governor.
Advertisement
"What we're seeing is young people getting involved, particularly in the Democratic Party," he said.

Hours before the vote, supporters of Mayor Martin J. Walsh were hinting the two-term mayor's support for Zakim to the hundreds of Boston-based delegates voting, offering the city councilor a convention-day bump.
"I would prefer to win," Galvin told reporters before the vote was official. "We have a fight now for the next 90 days, and we'll see what comes out."
The 4,500 delegates delivered their picks after hours of speeches from the arena's floor, where Democratic candidates repeatedly juxtaposed their progressive credentials against the specter of President Trump and, to a lesser degree, Governor Charlie Baker.
Galvin pointed to both the 2020 election, and Trump directly, as reasons to vote for him, calling himself the necessary check against any untoward activity at the ballots.

"My ask of you today is not to reward my past service performance. My ask of you today is to use me and my skills and my knowledge and my expertise to protect the election process going forward," Galvin said from the stage.
"Because if you don't think the Russians and Donald Trump are going to try to affect the election in 2020, I think I've got a bridge to sell you," he said.
The comment also served as a veiled jab at Zakim. He's touted himself as "a bridge to progress" in his own play on words on the city's Zakim Bridge, which was named for his late father, Leonard Zakim, a civil rights activist.
Advertisement
Zakim repeatedly emphasized his push for election proposals to delegates, pointing to same-day voter and automatic registration, the latter of which Galvin supports but Zakim said has languished for too long.
"Despite the fact that it's 2018, that it's Massachusetts, very real barriers to our democracy persist," Zakim said. "That's unacceptable. Voting should be easy, and politicians who stand in the way of that should be shown the door."

In the governor's race, both Gonzalez and Massie are vying for the party's nomination to face off against Baker, the popular Republican who polls show holds an overwhelming lead among voters with less than six months to go before the November election.
Gonzalez won the endorsement after delivering an impassioned speech that used his height — he stands at 5 feet, 3½ inches, according to his campaign — to sew in a theme of fighting for the "little guy" in ways Baker hasn't.
"Baker hides behind the chaos that Trump creates. He hopes we'll lower our expectations and just be grateful he isn't crazy like our president," Gonzalez said. "It's not good enough."
Speaking later to reporters, Gonzalez went further, saying Baker's approach is "being cautious, not taking a position when you don't have to and not doing anything if you don't have to. And that's going to end."
Advertisement
Few policy differences separate him and Massie, but they've leaned on their backgrounds in appealing to the party electorate: Gonzalez is coupling his experience in state government with progressive pitches such as single-payer health care; Massie, a longtime activist and former minister, is laying out a case for a "justice economy."

Massie downplayed losing the endorsement, saying that Gonzalez had devoted more attention to doing well at the convention than he did.
"This is just filling the requirement to get on the ballot," he said. "I think we're going to do great."
Matt Stout can be reached at matt.stout@globe.com. Follow him on twitter @mattpstout Frank Phillips can be reached at frank.phillips@globe.com.