Despite long lines at polls in many places, turnout overall looked to be down from four years ago as the president pieced together a winning coalition of women, young people, minorities and lower-income voters that reflected the country's changing demographics. Obama's superior ground organization in the most contested states was critical to his success.
Obama's victory speech — he'd written a concession, too, just in case — reflected the realities of the rough road ahead.
"By itself the recognition that we have common hopes and dreams won't end all the gridlock, or solve all our problems or substitute for the painstaking work of building consensus and making the difficult compromises needed to move this country forward," Obama said.
"But that common bond is where we must begin. Our economy is recovering. A decade of war is ending. A long campaign is now over, and whether I earned your vote or not, I have listened to you, I have learned from you and you have made me a better president."
The president said he hoped to meet with Romney and discuss how they can work together. They may have battled fiercely, he said, "but it's only because we love this country deeply."
Romney's short concession — he'd only prepared an acceptance speech — was a gracious end note after a grueling campaign.
He wished the president's family well and told subdued supporters in Boston, "I so wish that I had been able to fulfill your hopes to lead the country in a different direction, but the nation chose another leader and so Ann and I join with you to earnestly pray for him and for this great nation."
Obama won even though exit polls showed that only about 4 in 10 voters thought the economy is getting better, just one-quarter thought they're better off financially than four years ago and a little more than half think the country is on the wrong track.
But even now, four years after George W. Bush left office, voters were more likely to blame Bush than Obama for the fix they're in.
Elsewhere on the ballot, voters in Maine and Maryland became the first to approve same-sex marriage by popular vote while Washington state and Colorado legalized recreational use of marijuana.
The most expensive presidential campaign in history, at $2 billion plus, targeted people in the nine states that determined the outcome, and the two sides drenched voters there with more than a million ads, the overwhelming share of them negative.
Obama claimed at least seven of those states, most notably Ohio, seen as the big prize. He also prevailed in Iowa, New Hampshire, Colorado, Nevada, Virginia and Wisconsin. Romney got North Carolina.
Florida was too close to call Wednesday morning. The unofficial count had Obama with a 46,000-vote lead, but Florida historically has left as many as 5 percent of its votes uncounted until after Election Day.
Overall, Obama won 25 states and the District of Columbia. Romney won 24 states.
It was a more measured victory than four years ago, when Obama claimed 365 electoral votes to Arizona Sen. John McCain's 173, and won 53 percent of the popular vote.
Preliminary figures indicate fewer people participated this time. Associated Press figures showed that about 118 million people had voted in the White House race, but that number will rise as more votes are counted. In 2008, 131 million people voted, according to the Federal Election Commission.
Obama was judged by 53 percent of voters to be more in touch with people like them. More good news for him was that 6 in 10 voters said taxes should be increased, and that nearly half of voters said taxes should be increased on incomes over $250,000, as Obama has called for.
Obama's list of promises to keep includes many holdovers he was unable to deliver on in his first term, such as rolling back tax cuts for upper-income people, overhauling immigration policy and reducing federal deficits.
A second term is sure to produce turnover in his Cabinet. Treasury Secretary Timothy Geithner has made it clear he wants to leave at the end of Obama's first term but is expected to remain in the post until a successor is confirmed. Secretary of State Hillary Rodham Clinton, Obama's rival for the presidency four years ago, is ready to leave. Defense Secretary Leon Panetta isn't expected to stay on.
To the end, the presidential race was a nail-biter. About 1 in 10 voters said they'd only settled on their choice in the last few days or even on Election Day, and they were closely divided between Obama and Romney. Nearly 1 percent of voters went for Libertarian Party candidate Gary Johnson, who was on the ballot in 48 states.
In an election offering sharply different views on the role of government, voters ultimately narrowly tilted toward Obama's approach.
"We have seen growth in the economy," said 25-year-old Matt Wieczorek, a registered Republican from Cincinnati who backed the president. "Maybe not as fast as we want it to be, but Obama has made a difference and I don't want to see that growth come to an end."
Notwithstanding his victory, Obama will lead a nation with plenty of people who were ready for a change.
"The last four years have been crap," said 73-year-old Marvin Cleveland, a Romney supporter in Roseville, Minn. "Let's try something else."
Associated Press writer Nedra Pickler contributed to this report.
Follow Nancy Benac on Twitter: http://www.twitter.com/nbenac
- Canada man finds an Elizabeth Gallagher for...
- Final goodbye: A roll call of some who died...
- Final goodbye: Roll call of some who died in...
- Vermont governor abandons single-payer health...
- 82-year-old caught in Sydney hostage...
- Utah mourners for Pakistani children killed...
- Obama: US re-establishing diplomatic...
- 10 Things to See: A week of top AP photos
- Obama: US re-establishing diplomatic... 45
- End gun violence, say faith leaders on... 32
- Vermont governor abandons single-payer... 31
- Police: 3 dead, including gunman, in... 18
- Sony cancels 'The Interview' Dec. 25... 15
- Taliban assault on Pakistan school... 12
- Utah football's Hackett, Orchard named... 11
- NYC premiere of Rogen film 'The... 8