In defeating Mitt Romney, the president carried Colorado, Iowa, Ohio, New Hampshire, Virginia and Wisconsin, a near sweep of the battleground states, and was holding a narrow advantage in Florida. The path to victory for Romney narrowed as the night wore along, with Obama winning at least 303 electoral votes.
A cheer of jubilation sounded at the Obama campaign headquarters in Chicago when the television networks began projecting him as the winner at 11:20 p.m., even as the ballots were still being counted in many states where voters had waited in line well into the night. The victory was narrower than his historic election four years ago, but it was no less dramatic.
"Tonight in this election, you, the American people, reminded us that while our road has been hard, while our journey has been long, we have picked ourselves up, we have fought our way back," Obama told his supporters early Wednesday. "We know in our hearts that for the United States of America, the best is yet to come."
Obama's re-election extended his place in history, carrying the tenure of the nation's first black president into a second term. His path followed a pattern that has been an arc to his political career: faltering when he seemed to be at his strongest - the period before his first debate with Romney - before he redoubled his efforts to lift himself and his supporters to victory.
The evening was not without the drama that has come to mark so many recent elections: For more than 90 minutes after the networks projected Obama as the winner, Romney held off calling him to concede. And as the president waited to declare victory in Chicago, Romney's aides were prepared to head to the airport, suitcases packed, potentially to contest several close results.
But as it became increasingly clear that no amount of contesting would bring him victory, he called Obama to concede shortly before 1 a.m.
"I wish all of them well, but particularly the president, the first lady and their daughters," Romney told his supporters in Boston. "This is a time of great challenges for America, and I pray that the president will be successful in guiding our nation."
Hispanics made up an important part of Obama's winning coalition, preliminary exit poll data showed. And before the night was through there were already recriminations from Republican moderates who said Romney had gone too far during the primaries in his statements against those here illegally, including his promise that his get-tough policies would cause some to "self deport."
Obama, 51, faces governing in a deeply divided country and a partisan-rich capital, where Republicans retained their majority in the House of Representatives and Democrats kept their control of the Senate. His re-election offers him and Vice President Joe Biden another opportunity that will quickly be tested, given the rapidly escalating fiscal showdown.
For Obama, the result brings a ratification of his sweeping health care act, which Romney had vowed to repeal. The law will now continue on course toward nearly full implementation in 2014, promising to significantly change the way medical services are administrated nationwide.
Confident that the economy is finally on a true path toward stability, Obama and his aides have hinted that he would seek to tackle some of the grand but unrealized promises of his first campaign, including the sort of immigration overhaul that has eluded presidents of both parties for decades.
But he will be venturing back into a congressional environment similar to that of his first term, with the Senate under the control of Democrats and the House under the control of Republicans, whose leaders have hinted that they will be no less likely to challenge him than they were during the last four years.
The state-by-state pursuit of 270 electoral votes was being closely tracked by both campaigns, with Romney winning North Carolina and Indiana, which Obama carried four years ago. But Obama won Michigan, the state where Romney was born, and Minnesota and Pennsylvania, three states that Republican groups had spent millions of dollars trying to make competitive.
Americans delivered a final judgment on a long and bitter campaign that drew so many people to the polls that several key states extended voting for hours. In Virginia and Florida, long lines stretched from polling places, with the Obama campaign sending text messages to supporters in those areas, saying: "You can still vote."
Neither party could predict how the outcome would affect the direction of the Republican Party. Moderates were hopeful it would lead the rank and file to realize that the party's grass-roots conservatism that Romney pledged himself to during the primaries doomed him in the general election. Tea Party adherents have indicated that they will argue that he was damaged because of his move to middle ground during the general election.
As he delivered his brief concession speech early Wednesday, Romney did not directly address the challenges facing Republicans. His advisers said that his second failed quest for the White House would be his last, with his running mate, Rep. Paul Ryan of Wisconsin, standing as one of the leaders of the party.
"We have given our all to this campaign," said Romney, stoic and gracious in his remarks. "I so wish that I had ... been able to fulfill your hopes to lead this country in a different direction."
The results were more a matter of voters giving Obama more time than a second chance. Through most of the year slight majorities of voters had told pollsters that they believed his policies would improve the economy if they could stay in place into the future.
Obama's campaign team built its coalition the hard way, finding and motivating supporters who had lost the ardor of four years ago and, Obama's strategists feared, might not find their way to polls if left to their own devices.
Up against real enthusiasm for Romney - or, just as important, against Obama - among Republicans and many independents, their strategy of spending vast sums of money on their get-out-the-vote operation seemed vindicated on Tuesday.
As opinion surveys that followed the first debate between Romney and Obama showed a tightening race, Obama's team had insisted that its coalition was coming together as it hoped it would. In the end, it was not a bluff.
Even with Obama pulling off a new sweep of the highly-contested battlegrounds from Nevada to New Hampshire, the result in each of the states was very narrow.
The top issue on the minds of voters was the economy, according to interviews, with three-quarters saying that economic conditions were not good or poor. But only 3 in 10 said things were getting worse and 4 in 10 said the economy was improving.
Romney, who campaigned aggressively on his ability to turn around the deepest economic downturn since the Great Depression, was given a narrow edge when voters were asked which candidate was better equipped to handle the economy, the interviews found.
The electorate was split along partisan lines over a question that has driven much of the campaign debate, whether it was Obama or his predecessor, former President George W. Bush, who bore the most responsibility for the nation's continued economic challenges. But about half of independent voters said that Bush should be held responsible.
The president built a muscular campaign organization and used a strong financial advantage to hold off an array of forces that opposed his candidacy. The margin of his victory was smaller than in 2008 - he held an advantage of about 700,000 in the popular vote early Wednesday - but a strategic firewall in several battleground states protected his Electoral College majority.
"Whether I earned your vote or not, I have listened to you. I have learned from you, and you made me a better president," Obama said in accepting victory. "I return to the White House more determined and more inspired than ever about the work there is to do and the future that lies ahead."
As Romney gained steam and stature in the final weeks of the campaign, the Obama campaign put its hopes in one thing perhaps above all others: that the rebound in the auto industry after the president's bailout package of 2009 would give him the winning edge in Ohio, a linchpin of his road to re-election.
Early interviews with voters showed that nearly 6 in 10 Ohio voters approved of the bailout, a result that was balanced by a less encouraging sign for the president: Almost 4 in 10 said they or someone in their household had lost a job over the last four years.
The strong early-voting program was central to Obama's performance in Ohio. He defeated Romney 52 per cent to 47 per cent in Hamilton County, home to Cincinnati, but only because of the amount of votes he banked in the month leading up to Election Day.
Obama won despite losing some of his 2008 margins among his key constituencies, including among younger voters, blacks and Jewish voters, yet he appeared to increase his share among Hispanics and Asians. Early poll results showed Latinos representing about 1 in 10 voters nationwide and voting for Obama in greater numbers than four years ago, making a difference in several states, including Colorado and Florida. He held on to female voters, according to preliminary exit polls conducted by Edison Research, but he struggled even more among white men than he did four years ago.
Romney's coalition included disproportionate support from whites, men, older people, high-income voters, evangelicals, those from suburban and rural counties, and those who call themselves adherents of the Tea Party - a group that had resisted Romney through the primaries but had fully embraced him by Election Day.
The Republican Party seemed destined for a new round of self-reflection over how it approaches Hispanics going forward, a fast-growing portion of the voting population that senior party strategists had sought to woo before a strain of intense anti-illegal immigration activism took hold within the Republican grassroots.
It was the first presidential election since the 2010 Supreme Court decision loosening restrictions on political spending, and the first in which both major party candidates opted out of the campaign matching system that imposes spending limits in return for federal financing. And the overall cost of the campaign rose accordingly, with all candidates for federal office, their parties and their supportive "super PACs" spending more than $6 billion combined.
The results Tuesday were certain to be parsed for days to determine just what effect the spending had, and who would be more irate at the answer - the donors who spent literally millions of dollars of their own money for a certain outcome, or those who found a barrage of negative advertising to be major factors in their defeats.
While the campaign often seemed small and petty, with Romney and Obama intensely quarrelling and bickering, the contest was actually rooted in big and consequential decisions, with the role of the federal government squarely at the centre of the debate.
In Chicago, as crowds waited for Obama to deliver his speech, his supporters erupted into a roar of relief and elation. Car horns honked from the street as people chanted the president's name.
"I feel like it's a repudiation of everything the Republicans said in the campaign," said Jasmyne Walker, 31, who jumped up and down on the edge of a stone planter in a downtown plaza. "Everybody said that if he lost it would be buyer's remorse - that we were high on hope in 2008. This says we're on the right track. I feel like this confirms that."
Michael Cooper contributed reporting.
© 2012, The New York Times News Service