Massachusetts on Tuesday elected the state's first Republican to serve in the Senate in decades, a stunning upset that threatens to undermine Democrats' dominance in Washington.

The once-safe Democratic seat, held by party giant Edward Kennedy until his death last August, was won convincingly by Republican state Senator Scott Brown over Democratic state Attorney General Martha Coakley.

With 95 percent of precincts reporting, Brown led by about 5 percentage points.

Here are some reasons why the New England state's 6.5 million people turned away from Democrats after President Barack Obama won the state handily in the 2008 presidential election:

+ National anti-incumbent sentiment

The party in power traditionally loses seats in an off-year election after a presidential victory, and for Obama the backlash seems well under way.

Massachusetts is traditionally among the most liberal U.S. states, but in the latest election became part of a national swing against Obama and the Democrats who control Congress by a wide margin.

Conservative groups sent in millions of dollars in donations to fund advertising, and a small army of volunteers helped Brown get out the vote, neutralizing the Democrats' perceived advantage in the electoral ground war.

Obama won the state by 26 percentage points in 2008. But his popularity among likely voters in the Massachusetts election was estimated at under 50 percent in three polls over the past week.

+ Healthcare legislation and costs

Concerns about the cost of the potential healthcare legislation, as well as the rising federal deficit, energized support for Brown in many areas.

Brown vowed to be the 41st vote against the Democrats' healthcare reform bill, while Coakley promised to support the bill.

Respondents to several pre-election polls cited healthcare reform, the weak economy and high unemployment as the biggest factors guiding their votes.

Massachusetts enacted a near-universal state healthcare law in 2006 -- a move supported by Brown in the state Senate. The state arguably has less to gain from the federal measures now being considered.

+ Democrat was weak candidate

Democratic contender Coakley has won solid approval ratings as state attorney general since 2006.

But after cruising to victory in a four-way primary battle in December, Coakley conducted what many pundits called an ineffective campaign -- especially compared with Brown, a personable attorney and former model who made a marathon trek across the state in his pickup truck to court voters.

Coakley disappeared from the campaign trail for almost a week around Christmas, at just the time that Brown's campaign was catching fire.

Independent voters who came out in force for Obama were cool on Coakley. A large slice of Brown's support came from independents in suburban areas who voted for Obama in 2008.

+ Kennedy fatigue

Kennedy's passing marked the end of an era, with none of the younger Kennedy generation opting to make a run.

Most of the Democratic primary contenders -- although not Coakley -- tried to exploit the Kennedy mystique. Kennedy's widow, Vicki, campaigned for Coakley and urged voters to continue her husband's legacy.

But Brown got in the best zinger of the campaign, in a televised debate with Coakley on January 11:

With all due respect, it's not the Kennedys' seat. It's not the Democrats' seat. It's the people's seat.

+ Voters fed up with political corruption

Coakley has arguably been swept up in a backlash against Massachusetts' long history of one-party dominance.

The concentration of power in the hands of the Democratic Party has given rise to a series of scandals that disgusted some normally reliable Democratic voters.

Three consecutive former Massachusetts House speakers have been indicted, and three state senators have resigned in disgrace in the past two years for various infractions.

(Reporting by Ros Krasny; Editing by Mary Milliken and Peter Cooney)