The loss by the once-favored Coakley for the seat that the late Sen. Edward M. Kennedy held for nearly half a century signaled big political problems for the president's party this fall, when House, Senate and gubernatorial candidates are on the ballot nationwide.
More immediately, Brown will become the 41st Republican in the 100-member Senate, which could allow the GOP to block the president's health care legislation and the rest of Obama's agenda. Democrats needed Coakley to win to have a 60th vote to thwart Republican filibusters.
Democratic fingerpointing began more than a week ago as polls started showing a tight race, with the White House accusing Coakley of a poor campaign and the Coakley camp laying t some of the blame on the administration. Obama flew to Boston for last-ditch personal campaigning on Sunday.
With 87 percent of precincts counted, Brown led Coakley, 52 percent to 47 percent.
The election transformed reliably Democratic Massachusetts into a battleground state. One day shy of the first anniversary of Obama's swearing-in, it played out amid a backdrop of animosity and resentment from voters over persistently high unemployment, industry bailouts, exploding federal budget deficits and partisan wrangling over health care.
For weeks considered a long shot, Brown seized on such discontent to overtake Coakley in the final stretch of the campaign. Surveys showed his candidacy energized Republicans, including backers of the grass-roots "tea party" movement, while attracting disappointed Democrats and independents uneasy with where they felt the nation was heading.
Turnout was relatively heavy for a special election despite a mix of snow and rain showers across the state virtually all day.
Though he wasn't on the ballot, the president was on many voters' minds.
"I voted for Obama because I wanted change. ... I thought he'd bring it to us, but I just don't like the direction that he's heading," said John Triolo, 38, a registered independent who voted in Fitchburg.
He said his frustrations, including what he considered the too-quick pace of health care legislation, led him to vote for Brown.
But Robert Hickman, 55, of New Bedford, said he backed Coakley "to stay on the same page with the president."
Even before the first results were announced, administration officials were privately accusing Coakley of a poorly run campaign and playing down the notion that Obama or a toxic political landscape had much to do with the outcome.
Coakley's supporters, in turn, blamed that very environment, saying her lead dropped significantly after the Senate passed health care reform shortly before Christmas and after the Christmas Day attempted airliner bombing that Obama himself said showed a failure of his administration.
While votes were still being cast, White House spokesman Robert Gibbs said the president "was both surprised and frustrated ... not pleased" at how competitive the race had become in the final weeks.
Wall Street watched the election closely. The Dow Jones industrial average rose 116 points, and analysts attributed the increase to hopes the election would make it harder for Obama to make his changes to health care. That eased investor concerns that profits at companies such as insurers and drug makers would suffer.