Obama's Ohio victory denied McCain particularly precious territory. No Republican has ever won the presidency without it.
The 47-year-old Illinois senator watched returns at a downtown Chicago hotel, then went home to a family dinner after a marathon campaign across 49 states and 21 months.
A jubilant crowd of thousands gathered in Grant Park across town on an unseasonably mild night. Cheers went up each time Obama was announced the winner in another state. The roar was particularly loud when Pennsylvania fell — the Democratic-leaning state where McCain had tried hardest to break through.
A survey of voters leaving polling places showed the economy was by far the top Election Day issue. Six in 10 voters said so, and none of the other top issues — energy, Iraq, terrorism and health care — was picked by more than one in 10.
"May God bless whoever wins tonight," President Bush told dinner guests at the White House, where his tenure runs out on Jan. 20.
He'll depart with the economy almost certainly in recession and millions of Americans counting their investment losses after a stock market swoon. The next commander in chief will inherit two wars, as well, one in Iraq, the other in Afghanistan.
On Election Day, Obama swept through traditionally Democratic states in the East and Midwest.
McCain countered in normally secure Republican territory.
That left a string of battleground states. All had voted for President Bush in his narrow victory in 2004, but Obama invested heavily in hopes of succeeding Bush as the nation's 44th president.
In addition to Ohio and Iowa, he led narrowly in Florida and by even less in Virginia and North Carolina. McCain owned a small advantage in Missouri and the two were virtually tied in Indiana.
Interviews with voters suggested that almost six in 10 women were backing Obama nationwide, and men leaned his way by a narrow margin. Just over half of whites supported McCain, giving him a slim advantage in a group that Bush carried overwhelmingly in 2004.
The results of The Associated Press survey were based on a preliminary partial sample of nearly 10,000 voters in Election Day polls and in telephone interviews over the past week for early voters.
Obama had 202 of the 270 electoral votes needed to win the White House. McCain had 114.
The Democrat's states included Iowa, Ohio, Wisconsin, Michigan, New York, Rhode Island, Minnesota, Pennsylvania, New Hampshire, Vermont, Connecticut, Delaware, Illinois, Maine, Massachusetts, Maryland and New Jersey, as well as the District of Columbia.
McCain had Texas, Utah, Arkansas, Kansas, Kentucky, Tennessee, Oklahoma, Wyoming, Alabama, South Carolina, Louisiana, West Virginia and North Dakota.
The nationwide popular vote was remarkably close. Totals from 41 percent of all U.S. precincts showed Obama with 50.5 percent and McCain with 48.3.
Democrats celebrated Senate successes in Virginia, where former Gov. Mark Warner won an open seat, and in New Mexico, where Rep. Tom Udall did likewise. In New Hampshire, former Gov. Jeanne Shaheen defeated Republican Sen. John Sununu in a rematch of their 2002 race, and Sen. Elizabeth Dole fell to Democrat Kay Hagan in North Carolina.
That wasn't the end of the Democratic targets, though. Republicans all but conceded in advance they would lose a seat in Colorado, and perhaps elsewhere.
Democrats also looked for gains in the House. They found their first in Florida, defeating Rep. Tom Feeney, and another in Connecticut, where 22-year veteran Chris Shays was swept away by the Democratic tide.
The resurgent Democrats also elected a governor in one of the nation's traditional bellwether states when Missouri Attorney General Jay Nixon won his race.
The White House was the main prize of the night on which 35 Senate seats and all 435 House seats were at stake. In both houses, Democrats hoped to pad their existing majorities, and Republicans braced for losses.
A dozen states elected governors, and ballots across the country were dotted with issues ranging from taxes to gay rights.
An estimated 187 million voters were registered, and in an indication of interest in the battle for the White House, 40 million or so had already voted as Election Day dawned.
At 47, with only four years in the Senate, he sought election as one of the youngest presidents, and one of the least experienced in national political affairs.
That wasn't what set the Illinois senator apart, though — neither from his rivals nor from the 43 men who had served as president since the nation's founding more than two centuries ago. A black man, he confronted a previously unbreakable barrier as he campaigned on twin themes of change and hope in uncertain times.
McCain, a prisoner of war during Vietnam, a generation older than his rival at 72, waited in Arizona to learn the outcome of the election. It was his second try for the White House, following his defeat in the battle for the GOP nomination in 2000.
A conservative, he stressed his maverick's streak. And a Republican, he did what he could to separate himself from an unpopular president.
For the most part, the two presidential candidates and their running mates, Republican Gov. Sarah Palin of Alaska and Democratic Sen. Joe Biden of Delaware, spent weeks campaigning in states that went for Bush four years ago. Virginia, Florida, North Carolina, Ohio, Iowa, Colorado, New Mexico and Nevada drew most of their time. Pennsylvania also drew attention as McCain sought to invade traditionally Democratic turf.
McCain and Obama each won contested nominations — the Democrat outdistancing former first lady Hillary Rodham Clinton — and promptly set out to claim the mantle of change.
"I am not George W. Bush," McCain said in one debate.
Obama retorted that he might as well be, telling audiences in state after state that the Republican had voted with the president 90 percent of the time across eight years of the Bush administration.