McCain's lead among white women was especially thin - roughly 5 percentage points. Overall, he was backed by just over half of white voters, a group that had favored President Bush over John Kerry by 17 percentage points in 2004.
Obama, who would be one of the youngest presidents to take office at 47, was running away with the youth vote - winning the under-30 crowd by 38 percentage points, even better than Democrat Bill Clinton's 19-point advantage over Bob Dole in 1996.
McCain, 72, got support from just over half of senior citizens, coveted for their vigilance in going to the polls. Those age 65 or older did as much voting as the under-30 bloc: Each group made up about 17 percent of all voters.
McCain also drew strength from white, working-class voters, according to preliminary exit polls. Whites who haven't finished college were giving him heavy support, but short of the 23-point margin by which Bush won their vote in 2004.
Enthusiasm clearly was on Obama's side: Almost six in 10 of his voters said they were excited about what Obama would do as president. Fewer than three in 10 McCain voters felt that way about their man.
Fear played no favorites. Among both Obama and McCain voters, about half said they were "scared" of what the candidate they opposed would do as president.
Obama drew the votes of two-thirds of Hispanic voters - heavily courted by both candidates - and nearly all blacks who went to the polls.
He seemed to inspire optimism about race in America. About 60 percent of Obama's voters believe race relations will improve over the next few years, while about the same number of McCain voters expect relations to stay the same or deteriorate.
In both camps, about one voter out of five acknowledged that the candidates' race was a factor in their vote, but almost no one said it was the most important factor.
Women voters typically are the key to a Democratic presidential victory, and Obama was pulling well over half their votes. He held a narrower edge over McCain among men, according to the preliminary national survey.
One in five of the first-time voters was black, almost twice the proportion of blacks among voters overall. Another one in five of the new voters was Hispanic. About two-thirds of them were under 30.
A third of first-time voters this year said they were political independents; only about one in 5 was a Republican.
Twenty-six-year-old Jennifer Sunderlin, who typically votes Republican, said she didn't stick with her usual party this election year.
"Don't tell my Dad, but I voted for Barack Obama," said Sunderlin, of Albany, N.Y. She said she was turned off by McCain's choice of Alaska Gov. Sarah Palin as his running mate.
She wasn't alone. Four in 10 voters overall said Palin was an important factor in deciding whom to vote for, and this group leaned slightly toward Obama. But nine in 10 Republicans calling Palin's selection important were voting for McCain.
About a third of voters said the quality that mattered most to them was the candidates' ability to bring about change - the mantra of Obama's campaign - while a fifth focused on the candidates' experience, McCain's strong point.
"I don't think Obama knows what he's doing," said Craig Burnett, 55, a Republican in Hagerstown, Md. "He's too young and inexperienced."
More than half of voters strongly disapproved of the way Bush has handled the job, and they voted overwhelmingly for Obama.
Two-thirds of voters worried about how to pay for health care and at least as many feared terrorists will attack the U.S. again. But the economy weighed heaviest on their minds.
Six in 10 voters picked it as the most important issue facing the nation, according to preliminary polling. None of the four other issues listed by exit pollsters - energy, Iraq, terrorism and health care - was picked by more than one in 10 people.
Almost everyone agreed the economy's condition is either "poor" or "not good." And more than eight in 10 said they were worried about the economy's direction over the next year.
Half of voters said they're very worried the current economic crisis will harm their families, and another third were somewhat worried about that. One reason: about two-thirds of voters have stock market investments, such as retirement funds.
Yet there was room for optimism - nearly half predict the economy will get better over the next year.
The results were from exit polling by Edison Media Research and Mitofsky International for The Associated Press and television networks conducted in 300 precincts nationally. The preliminary data was based on 10,065 voters, including telephone polling of 2,407 people who voted early, and has a margin of sampling error of plus or minus 1 percentage point for the entire sample, smaller for subgroups.