Former state lawmaker Mike Barrett won a closely fought Democratic primary for a state Senate seat northwest of Boston Thursday, and Salem city council president Joan Lovely topped the primary field in her hometown district, in two of several legislative contests across the state.
Barrett defeated four rivals, including Joseph Kearns Goodwin, who had twice the money and some celebrity backers, to become the Democratic nominee in the Third Middlesex District Senate race.
In the Second Essex District, Lovely won the four-way Democratic senate primary in a landslide. An eight-term member of the Salem City Council, Lovely will be vying with Richard A. Jolitz, a Beverly Republican for the seat left open this year by Peabody Democrat and Senate Majority Leader Frederick E. Berry. Berry is retiring after nearly three decades on Beacon Hill.
Voters also leaned on experience in the Third Middlesex District, which includes Bedford, Carlisle, Chelmsford, Concord, Lincoln, Waltham, Weston and parts of Lexington and Sudbury.
Barrett, a Lexington resident and former state senator, stressed his prior work experience.
“It is truly a victory of grassroots campaigning over celebrity and money,” Barrett said of his victory late Thursday.
He beat Kearns Goodwin, of Concord, by 300 votes to win the nomination, according to Kearns Goodwin’s campaign manager Cayce McCabe.
Kearns Goodwin, whose father is a former presidential advisor and mother is historian and author Doris Kearns Goodwin, received contributions from Steven Spielberg and Major League Baseball’s commissioner Bud Selig.
Barrett will likely face Chelmsford Republican Sandi Martinez, who was claiming victory over Concord Republican Gregory Howes late Thursday. Martinez said Howes called to concede after 11 p.m. Thursday and she will now turn her efforts toward beating Barrett in the general election.
Martinez said there will be sharp contrasts between her and Barrett as they compete for the seat left vacant by retiring state Senator Susan Fargo.
This year’s races feature several other efforts to replace veteran lawmakers.
Newburyport city councilor at large Kathleen A. O’Connor Ives won the Democratic primary and Shaun P. Toohey of Haverhill won the Republican primary for the First Essex state Senate seat ethuen Democrat Steven A. Baddour held until he resigned in April.
Ives, a three-term councilor, picked up 38 percent of the vote, to 31 percent apiece for former three-term Methuen Mayor William M. Manzi III, and Timothy J. Coco, a business owner from Haverhill, in unofficial results.
“I think it was a combination of my background, my approach to problem solving, what I’m sharing with people about my ideas and positions on issues,” said Ives, an attorney who launched an online retail business this year.
Toohey, a Haverhill School Committee member, collected 67 percent of the vote in the GOP primary.
Ives and Toohey will vie in the November election with two unenrolled candidates, Amesbury Councilor at large James M. Kelcourse, and Haverhill School Committee member Paul A. Magliocchetti. This is one of a handful of seats that state Republicans are eyeing to flip in November.
State Representative Harriett L. Stanley is retiring in the Second Essex District, offering Republicans another opening.
Lenny Mirra, of West Newbury, won a three-way Republican primary in that district. Mirra, a former member of the Groveland Conservation Commission, received 44 percent of the vote, defeating Bob Cronin, of Boxford, and Georgetown selectman Gary C. Fowler.
“I’ve never run for any elective office before, and this is the most exciting thing I’ve ever done in my life,” Mirra said.
Mirra will compete in November with West Newbury Democrat Barry P. Fogel.
In the 11th Plymouth District, Claire D. Cronin won a tight race for the Democratic nomination with 39 percent of the total votes. Cronin, a lawyer who lives in Easton, will take on Republican Daniel J. Murphy of Easton in the race to succeed Representative Geraldine Creedon, a Brockton Democrat, who is retiring after 18 years on Beacon Hill.
The 4th Middlesex District will be a rematch in November.
Boston lawyer Danielle Gregoire won the Democratic primary for the state representative in the district Thursday with three-quarters of the vote for the seat representing Marlborough and parts of Northborough and Westborough.
Gregoire, a Marlborough native, previously held the seat for one term before being ousted by incumbent Steven Levy in 2010 by 100 votes. Levy ran unopposed in th e GOP primary.
On Thursday, voters in the 10th Norfolk District House race determined the Republican and Democratic nominees for November. Democrat Jeffrey N. Roy, a Franklin lawyer, won with 57 percent of the vote. He will face Republican Richard A. Eustis, a Medway lawyer, who won with 64 percent of the vote.
David M. Rogers, a Cambridge lawyer, narrowly won a three-way Democratic primary Thursday for the 24th Middlesex District House race.
Rogers will face Republican Tommasina Anne Olson in November to fill a seat that has been vacant since incumbent Democrat William Brownsberger stepped down after being elected to state Senate. The district represents Belmont, Arlington and Cambridge.
In the Norfolk 14th District Democratic House primary, incumbent Democrat Alice Hanlon Peisch won with 93 percent of the vote, in unofficial results.
Deirdre Fernandes can be reached at firstname.lastname@example.org. Globe correspondents Laura Franzini, Jaclyn Reiss, Ryan Mooney, Ellen Ishkanian, and John Laidler contributed to this report.