He added, "There are many who won't agree with every decision or policy I make as president, and we know that government can't solve every problem. But I will always be honest with you about the challenges we face."
McCain called his former rival to concede defeat -- and the end of his own 10-year quest for the White House. "The American people have spoken, and spoken clearly," McCain told disappointed supporters in Arizona.
President Bush added his congratulations from the White House, where his tenure runs out on Jan. 20. "May God bless whoever wins tonight," he had told dinner guests earlier.
Obama, in his speech, invoked the words of Lincoln, recalled Martin Luther King Jr., and seemed to echo John F. Kennedy.
"So let us summon a new spirit of patriotism, of service and responsibility where each of us resolves to pitch in and work harder," he said.
He and his running mate, Sen. Joseph Biden of Delaware, will take their oaths of office as president and vice president on Jan. 20, 2009. McCain remains in the Senate.
Sarah Palin, McCain's running mate, returns to Alaska as governor after a tumultuous debut on the national stage.
He will move into the Oval Office as leader of a country that is almost certainly in recession, and fighting two long wars, one in Iraq, the other in Afghanistan.
The popular vote was close -- 51.7 percent to 47 percent with 84 percent of all U.S. precincts tallied -- but not the count in the Electoral College, where it mattered most.
There, Obama's audacious decision to contest McCain in states that hadn't gone Democratic in years paid rich dividends.
Shortly after 2 a.m. in the East, The Associated Press count showed Obama with 349 electoral votes, well over the 270 needed for victory. McCain had 147 after winning states that comprised the normal Republican base, including Texas and most of the South as well as several in the Midwest and Rocky Mountain west.
By comparison, Bush won the White House twice, and never tallied more than 286 electoral votes.
Four states remained unsettled -- Georgia, Missouri and North Carolina. All voted for Bush in 2004.
Interviews with voters suggested that almost six in 10 women were backing Obama nationwide, while 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 AP 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 has said his first order of presidential business will be to tackle the economy. He has also pledged to withdraw most U.S. combat troops from Iraq within 16 months.
In Washington, the Democratic leaders of Congress celebrated.
"It is not a mandate for a party or ideology but a mandate for change," said Senate Majority leader Harry Reid of Nevada.
Said Speaker Nancy Pelosi of California: "Tonight the American people have called for a new direction. They have called for change in America."
Democrats also acclaimed Senate successes by former Gov. Mark Warner in Virginia, Rep. Tom Udall in New Mexico and Rep. Mark Udall in Colorado. All won seats left open by Republican retirements.
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.
Biden won a new term in Delaware, a seat he will resign before he is sworn in as vice president.
The Senate's Republican leader, Mitch McConnell, survived a scare in Kentucky.
In Georgia, Republican Sen. Saxby Chambliss hoped to avoid a December runoff. His was one of four races that were uncalled. The others were in Alaska, Minnesota and Oregon, and in each, Republican incumbents hoped to eke out victories.
The Democrats piled up gains in the House, as well.