Obama and Biden won Massachusetts with 60.7% of the popular vote to Romney's and Ryan's 37.5%, thus winning the state's 11 electoral votes, despite the fact that it is Romney's home state and he was Governor of the state from 2003 to 2007.
Massachusetts has not voted for a Republican presidential candidate since 1984. Romney's 37.51% of the vote is the most a Republican presidential candidate has received since 1988. It was also the sixth straight election (beginning in 1992) in which the Democratic presidential candidate swept every one of the state's 14 counties.
Incumbent president Barack Obama won the Democratic Primary with 81% of the vote. He wasn't challenged in the primary and the rest of the vote went to write-in candidates, through the primary and district caucuses, he won all of the state's 136 delegates which were pledged to vote for him at the 2012 Democratic convention in Charlotte, North Carolina.
The 2012 Massachusetts Republican primary was held on March 6, 2012. Among the 41 delegates to the Republican National Convention, 38 are awarded proportionately among candidates getting at least 15% of the vote statewide, and another three super delegates are unbound. Expectedly, Romney won Massachusetts by a landslide. Romney won the plurality in every town with the exception of 10 towns (Santorum winning 7, Paul winning 2, and a tie in 1), earning the majority in all but 53 towns.