Mr. McCain failed to take from Mr. Obama the two Democratic states that were at the top of his target list: New Hampshire and Pennsylvania. And in addition to Ohio, Democrats captured two other Republican states, Iowa and New Mexico.

Mr. Obama comes into office with Senator Joseph R. Biden Jr., Democrat of Delaware, his vice-presidential running mate. Even before the final results were called, there were indications that Mr. McCain’s advisers were in fact unhappy with their vice-presidential candidate, Ms. Palin, who was announced by Mr. McCain to an explosion of enthusiasm and interest by conservatives and since caused a series of embarrassments for Mr. McCain.

Mr. McCain’s chief strategist, Steve Schmidt, demurred when asked whether he thought in was happy with Ms. Palin’s performance. “I’m not going to go there,” Mr. Schmidt said. “There’ll be time for the post-mortems in the race.”

Initial signs were that Mr. Obama benefited from a huge turnout of voters, but particularly among blacks. That group of voters made up 13 percent of the electorate on Tuesday, according to surveys of people leaving the polls, compared with 11 percent in 2006. In North Carolina, Republicans said that the huge surge of African-Americans was one of the big factors that lead to Mrs. Dole’s loss.

Mr. Obama also did strikingly well among Hispanic voters, beating Mr. McCain did far less better among those voters than Mr. Bush did in 2004, suggesting the damage the Republican Party has suffered among those voters over four years in which Republicans have been at the forefront on the effort to crack down on illegal immigrants

As thousands of people gathered in downtown Chicago to celebrate their hometown candidate, the audience erupted in bursts of applause each time a state was called for Mr. Obama. The party took on the air of a drive-in movie theater, with his supporters remaining eerily quiet until a new development flashed across giant television screens. A thundering roar sounded when the roll call of projected Democratic victories suddenly included Ohio.

Senator Barack Obama stood on the brink of an historic victory Tuesday after he appeared to have won enough electoral votes to defeat Senator John McCain for president and to become the first African-American to serve as the nation’s chief executive.