Unruffled, and ahead in the polls, Obama parried each charge, and leveled a few of his own.
"One hundred percent, John, of your ads, 100 percent of them have been negative," Obama shot back in an uncommonly personal debate less than three weeks from Election Day.
"It's not true," McCain retorted.
"It absolutely is true," said Obama, seeking the last word.
McCain is currently running all negative ads, according to a study by the University of Wisconsin-Madison. But he has run a number of positive ads during the campaign.
The 90-minute encounter, at a round table at Hofstra University, was their third debate, and marked the beginning of a 20-day sprint to Election Day. Obama leads in the national polls and in surveys in many battleground states, an advantage built in the weeks since the nation stumbled into the greatest economic crisis since the Great Depression.
With few exceptions, the campaign is being waged in states that voted Republican in 2004 - Virginia, Colorado, Iowa - and in many of them, Obama holds a lead in the polls.
McCain played the aggressor from the opening moments of the debate, accusing Obama of waging class warfare by seeking tax increases that would "spread the wealth around."
The Arizona senator also demanded to know the full extent of Obama's relationship with William Ayers, a 1960s-era terrorist and the Democrat's ties with ACORN, a liberal group accused of violating federal law as it seeks to register voters. And he insisted Obama disavow last week's remarks by Rep. John Lewis, a Democrat, who accused the Republican ticket of playing racial politics along the same lines as segregationists of the past.
Struggling to escape the political drag of an unpopular Republican incumbent, McCain also said, "Sen. Obama, I am not President Bush. ... You wanted to run against President Bush, you should have run four years ago."
Obama returned each volley, and brushed aside McCain's claim to full political independence.
"If I've occasionally mistaken your policies for George Bush's policies, it's because on the core economic issues that matter to the American people - on tax policy, on energy policy, on spending priorities - you have been a vigorous supporter of President Bush," he said.
McCain's allegation that Obama had not leveled with the public involved the Illinois senator's decision to forgo public financing for his campaign in favor of raising his own funds. As a result, he has far outraised McCain, although the difference has been somewhat neutralized by an advantage the Republican National Committee holds over the Democratic Party.
"He signed a piece of paper" earlier in the campaign pledging to accept federal financing, McCain said. He added that Obama's campaign has spent more money than any since Watergate, a reference to President Nixon's re-election, a campaign that later became synonymous with scandal.
Obama made no immediate response to McCain's assertion about having signed a pledge to accept federal campaign funds.
Asked about running mates, both presidential candidates said Democrat Joseph Biden was qualified to become president, although McCain added this qualifier: "in many respects."
McCain passed up a chance to say his own running mate, Alaska Gov. Sarah Palin, was qualified to sit in the Oval Office, though he praised her performance as governor and noted her work on behalf of special needs children. The Palins have a son born earlier this year with Down Syndrome.
Obama sidestepped when asked about Palin's qualifications to serve as president, and he, too, praised her advocacy for special needs children.
But he quickly sought to turn the issue to his advantage by noting McCain favors a spending freeze on government programs.
"I do want to just point out that autism, for example, or other special needs will require some additional funding if we're going to get serious in terms of research. ... And if we have an across-the-board spending freeze, we're not going to be able to do it," he said.
In addition to differences on taxes and spending, McCain said Obama advocated trade policies that recalled those of Herbert Hoover, who presided over the start of the Great Depression.
Obama has called for tougher provisions in trade negotiations, arguing that is necessary to avoid undercutting the wages paid American workers.
McCain also said Obama has aligned himself with "the extreme aspect of the pro-abortion movement in America" and had voted present while in the Illinois Legislature on a measure to ban one type of procedure late in a woman's pregnancy.
Obama said the bill would have undermined Roe v. Wade, the Supreme Court ruling that granted abortion rights, and had been opposed by the Illinois Medical Society.
"I am completely supportive of a ban on late-term abortions, partial-birth or otherwise, as long as there's an exception for the mother's health and life, and this did not contain that exception," he added.
McCain sarcastically paid tribute to "the eloquence of Senator Obama. He's (for) health for the mother. You know, that's been stretched by the pro-abortion movement in America to mean almost anything."
McCain's allegation about class warfare stemmed from one of Obama's campaign appearances last weekend.
In Ohio on Sunday, Obama was approached by a man who said, "Your new tax plan's going to tax me more."
A video clip caught by Fox News shows Obama replying, "It's not that I want to punish your success. I just want to make sure that everybody who is behind you, that they've got a chance at success, too. And I think that when we spread the wealth around, it's good for everybody."
McCain referred repeatedly to that voter, Joe Wurzelbacher, a plumber from Toledo, Ohio.
Wurzelbacher watched Wednesday night's debate and said he still thinks Obama's plan would keep him from buying the small business that employs him.
McCain's reference to Ayers reprised campaign commercials he has run to try and raise doubts about Obama's fitness to serve.
Ayers, who was a member of the violent Weather Underground in the 1960s, hosted a meet-the-candidate event for Obama in an Illinois race many years later.
"The fact that this has become such an important part of your campaign, Sen. McCain, says more about your campaign than it says about me," Obama replied.
(Copyright 2008 by The Associated Press. All Rights Reserved.)