Massachusetts Attorney General Martha Coakley won the Democratic primary for governor, defeating Democratic party chair Steve Grossman by a smaller margin than expected.

Tuesday night Grossman threw his support behind Coakley after losing the primary election by 6 percentage points.

While it was a spirited campaign, the Grossman-Coakley race seemed never to have been a real contest. Even after spending $2 million, and winning the support of the Massachusetts Democratic Party establishment at its nominating convention this summer, Steve Grossman lagged behind the Attorney General by 20 points or more in the latest polls.

So the closeness of the vote primary election night came as a surprise to even Grossman’s supporters.

Cameron Cislack, one of Grossman’s supporters, watched results come in at Grossman headquarters at the Park Plaza hotel. Cislack said the results were closer than expected.

“But in a good way," Cislack said. "I think we learned, like in the last election 2012, you can't trust the polls, right?"

But it was not to be. With nearly all precincts reporting by 10 p.m., Coakley’s lead was insurmountable. Grossman conceded.

“And I told Martha Coakley that I will do everything I can, and I hope everyone of you will do everything you can to make sure that Martha Coakley becomes the next governor of Massachusetts,” Grossman said in his concession speech.

It’s not clear if Grossman will stay in politics or move on. This was his second run and second loss in the run for governor.

Wednesday morning, Steve Grossman and Martha Coakley will take part in a party unity breakfast at the Omni Parker House Hotel.