BOSTON (AP) — A candidate running for the seat left vacant by the resignation of former Democratic Senate President Stan Rosenberg has won the Democratic primary using a write-in campaign.

Jo Comerford, who works as a campaign director for the group MoveOn.org, defeated the only candidate on the ballot, Chelsea Kline, and two other write-in candidates in the Tuesday primary.

Comerford credited her win on the hundreds of volunteers who supported her candidacy.

Rosenberg resigned from the Senate in May after an ethics report concluded that as president he failed to protect the Senate from his husband, Bryon Hefner, who faces sexual misconduct charges.

Rosenberg stepped down just days after nomination papers were due, prompting the write-in campaigns.

The district pulls together two dozen Massachusetts communities including Northampton and Amherst.