WASHINGTON - President Barack Obama won re-election Tuesday night despite a fierce challenge from Republican Mitt Romney, prevailing in the face of a weak economy and high unemployment that encumbered his first term and crimped the middle class dreams of millions.
"This happened because of you. Thank you" Obama tweeted to supporters as he secured four more years in the White House.
The president sealed his victory in Ohio, Iowa, New Hampshire and Colorado, four of the nine battleground states where the two rivals and their allies spent nearly $1 billion on dueling television commercials.
Ultimately, the result of the brawl of an election campaign appeared likely to be the political status quo. Democrats won two more years of control of the Senate, and Republicans were on track to do likewise in the House.
Romney was in Massachusetts, his long and grueling bid for the presidency at an unsuccessful end.
The two rivals were close in the popular vote.
Romney had 45.2 million votes, or 49 percent. Obama had 45 million, also 49 percent, with 65 percent of precincts tallied.
But Obama's laser-like focus on battleground states gave him the majority in the electoral vote, where it mattered most. He had 284, or 14 more than needed for victory. Romney had 200.
Yet to be settled were battlegrounds in Florida, Virginia and Nevada.
The election emerged as a choice between two very different visions of government , whether it occupies a major, front-row place in American lives or is in the background as a less-obtrusive facilitator for private enterprise and entrepreneurship.
The economy was rated the top issue by about 60 percent of voters surveyed as they left their polling places. But more said former President George W. Bush bore responsibility for current circumstances than Obama did after nearly four years in office.
About 4 in 10 said the economy is on the mend, but more than that said it was stagnant or getting worse more than four years after the near-collapse of 2008. The survey was conducted for The Associated Press and a group of television networks.
Democrats got off to a quick start in their bid to renew their Senate majority, capturing seats in Indiana and Massachusetts now in Republican hands.
In Maine, independent former Gov. Angus King was elected to succeed retiring GOP Sen. Olympia Snowe. He has not yet said which party he will side with, but Republicans attacked him in television advertising during the race, and Democrats rushed to his cause.
Polls were still open in much of the country as the two rivals began claiming the spoils of a brawl of an election in a year in which the struggling economy put a crimp in the middle class dreams of millions.
The president was in Chicago as he awaited the voters' verdict on his four years in office. He told reporters he had a concession speech as well as victory remarks prepared. He congratulated Romney on a spirited campaign. "I know his supporters are just as engaged, just as enthusiastic and working just as hard today" as Obama's own, he added.
Romney reciprocated, congratulating the man who he had campaigned against for more than a year.
Earlier, he raced to Ohio and Pennsylvania for Election Day campaigning and projected confidence as he flew home to Massachusetts. "We fought to the very end, and I think that's why we'll be successful," he said, adding that he had finished writing a speech anticipating victory but nothing if the election went to his rival.
But the mood soured among the Republican high command as the votes came in and Obama ground out a lead in critical states.
Like Obama, Vice President Joe Biden was in Chicago as he waited to find out if he was in line for a second term. Republican running mate Paul Ryan was with Romney in Boston, although he kept one eye on his re-election campaign for a House seat in Wisconsin, just in case.
Voters also chose a new Congress to serve alongside the man who will be inaugurated president in January, Democrats defending their majority in the Senate, and Republicans in the House.
The long campaign's cost soared into the billions, much of it spent on negative ads, some harshly so.
In the presidential race, an estimated one million commercials aired in nine battleground states where the rival camps agreed the election was most likely to be settled , Ohio, New Hampshire, Virginia, Florida, North Carolina, Wisconsin, Iowa, Colorado and Nevada.
In a months-long general election ad war that cost nearly $1 billion, Romney and Republican groups spent more than $550 million and Obama and his allies $381 million, according to organizations that track advertising.
In Virginia, the polls had been closed for several minutes when Obama's campaign texted a call for volunteers "to make sure everyone who's still in line gets to vote."
In Florida, there were long lines at the hour set for polls to close. Under state law, everyone waiting was entitled to cast a ballot.
According to the exit poll, 53 percent of voters said Obama is more in touch with people like them, compared to 43 percent for Romney.
About 60 percent said taxes should be increased, taking sides on an issue that divided the president and Romney. Obama wants to let taxes rise on upper incomes, while Romney does not.
Other than the battlegrounds, big states were virtually ignored in the final months of the campaign. Romney wrote off New York, Illinois and California, while Obama made no attempt to carry Texas, much of the South or the Rocky Mountain region other than Colorado.
There were 33 Senate seats on the ballot, 23 of them defended by Democrats and the rest by Republicans.
Democratic Rep. Chris Murphy, a Democrat, won a Connecticut seat long held by Sen. Joe Lieberman, retiring after a career that included a vice presidential spot on Al Gore's ticket in 2000. It was Republican Linda McMahon's second defeat in two tries, at a personal cost of $92 million.
The GOP needed a gain of three for a majority if Romney won, and four if Obama was re-elected. Neither Majority Leader Harry Reid of Nevada nor GOP leader Mitch McConnell of Kentucky was on the ballot, but each had high stakes in the outcome.
All 435 House seats were on the ballot, including five where one lawmaker ran against another as a result of once-a-decade redistricting to take population shifts into account. Democrats needed to pick up 25 seats to gain the majority they lost two years ago.
Depending on the outcome of a few races, it was possible that white men would wind up in a minority in the Democratic caucus for the first time.
Speaker John A. Boehner, R-Ohio, raised millions to finance get-out-the-vote operations in states without a robust presidential campaign, New York, Illinois and California among them. His goal was to minimize any losses, or possibly even gain ground, no matter Romney's fate. House Democratic leader Rep. Nancy Pelosi of California campaigned aggressively, as well, and faced an uncertain political future if her party failed to win control.