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, nor has any Republican even broken 40% in the state since 1988. 2012 also marked the sixth straight election beginning in 1992 in which Democratic presidential candidates have 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.