Obama withstood a late push by Romney in Pennsylvania and won the most hotly contested states of Ohio, Virginia, Wisconsin, New Hampshire, Iowa, Nevada and Colorado, according to CNN projections. One other battleground state, Florida, remained too close to call early Wednesday.
The president also easily won traditional Democratic strongholds of California, New York and other populous states such as Michigan, where Romney was born and his father served as governor.
Obama and Romney ran dead even in final polls that hinted at a result rivaling some of the closest presidential elections in history, reflecting the deep political chasm in the country.
A heavy turnout was reported in much of the nation, and both campaigns expressed confidence that they would prevail in what was expected to be a long night awaiting results from the eight battleground states still up for grabs.
There were no surprises early, as each candidate won the states they were expected to capture and the races were tight in the battlegrounds. Then Obama was projected to win New Hampshire, followed by Wisconsin and Iowa, giving him the first three of the swing states.
Now Romney needed something close to a sweep of the remaining battlegrounds, especially the big three of Florida, Virginia and Ohio, to have a chance of reaching the decisive threshold of 270 electoral votes. When Obama was projected the winner of Ohio, it ensured his victory with the margin bolstered by picking up Colorado, Nevada and Virginia.
Economy most important issue
The president won his home state of Illinois as well as Romney' s home state of Massachusetts -- where the Republican previously served as governor.
In all, Obama won 25 states and the District of Columbia, while Romney also won 24 states with Florida yet to be decided.
Around the country, voters formed long lines at polling places after record numbers participated in early balloting, indicating a strong turnout.
Sporadic reports of irregularities included malfunctioning voting machines and electoral hardships for some struggling to recover from the devastation of Superstorm Sandy in Northeast states.
Overall, the total cost of the election for president and Congress could top a record $6 billion, according to the nonpartisan Center for Responsive Politics. The figure covers spending from January 2011 through whatever totals emerge after Tuesday's election.
Outside groups accounted for the biggest boost in spending, with independent organizations dropping more than $970 million. The increase was largely related to the 2010 U.S. Supreme Court ruling that paved the way for super PACs to raise and spend unlimited amounts of money as long as they did not coordinate with the campaigns.
As the challenger, Romney sought to frame the election as a referendum on Obama's presidency and to capitalize on his own business background by depicting himself as better able to handle economic issues identified by voters as their biggest concern.
His campaign stump speech hammered Obama over high unemployment and what he called excessive taxes and regulations that Romney said stifled faster growth.
Obama and his team attacked Romney's politics and his background as a venture capitalist, saying he would back policies favoring the wealthy over the middle class and exacerbate the already widening income and opportunity disparity in the country.
The president portrayed the race as competing visions for the future and built on his central theme of restoring the promise of the American dream of equal opportunity for all.
In particular, Obama repeatedly noted he backed a taxpayer bailout that helped restore General Motors and Chrysler while Romney opposed it. The issue resonated in auto industry states like Michigan and Ohio, both of which ended up providing crucial electoral votes for Obama.
Aside from the policy differences, the election amounted to a campaign chess match targeting specific states and demographic groups as part of a plan to create a path to electoral success.
Re-election offered Obama, 51, the chance to secure a two-term legacy and seek further reforms he promised in his historic campaign of 2008 but was unable to deliver in the first four years. In particular, he has made comprehensive immigration reform a top target, as well as a deficit reduction plan that ends tax breaks for income over $250,000.
However, the wave of optimism that carried to him to victory four years ago seemed muted during the campaign this time, with former supporters angered by the failure to achieve the kind of change in Washington they believed Obama had promised but failed to deliver.
For Romney, who sought to become the nation's first Mormon president, the election concluded a six-year quest for the White House.
Romney also failed in his first bid for the Republican nomination in 2008, then spent the next two years preparing for a second run that began in 2011 with the GOP primary campaign.
The 65-year-old was trying to win the office that his father -- former Michigan Gov. George Romney -- also sought but fell well short of winning in 1968.