Massachusetts Attorney General Martha Coakley has won the Democratic primary for governor.

Coakley defeated state treasurer and former Democratic party chairman Steven Grossman and former federal health care administrator Don Berwick in Tuesday's voting.

Coakley will carry her party's nomination into the November general election against Republican Charlie Baker, who won the GOP primary. There also will be three independent candidates.

Coakley is seeking a reversal of political fortune after her upset loss to Republican Scott Brown in the 2010 special election to succeed the late U.S. Sen. Edward Kennedy. Coakley says she learned from the mistakes of that campaign. She's in her second term as attorney general after serving as Middlesex district attorney.