Mr McCain's reference to Mr Obama's association with Bill Ayers, once a member of a US group that waged a violent campaign against the Vietnam War, continued the main Republican line of attack from the past 10 days.
Mr Obama rejected Mr McCain's criticism over Mr Ayers - now a university professor with whom he has served on a charity board - pointing out that he had been a child at the time of Mr Ayers' radical activities.
"Mr Ayers is not involved in my campaign," he said.
Mr McCain, senator for Arizona, also accused Mr Obama of big spending on attack ads.
The Illinois senator responded that 100% of Mr McCain's political adverts had been negative and that voters were more interested at this point in how the candidates planned to fix the economy.
'Spread the wealth'
The 90-minute debate, held at Hofstra University on Long Island, New York, with moderator Bob Schieffer of CBS News, elicited more direct confrontations between the candidates than their two previous encounters.
Again, McCain seems harsher, but is this not what debating is all about?
Mr McCain sought to fight back against Mr Obama's attempt to link him to the policies of the Bush administration.
"Senator Obama, I am not President Bush. If you wanted to run against President Bush, you should have run four years ago," he said.
Mr Obama countered: "If I have 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."
The two candidates also traded blows over their policies on energy.
While Mr Obama spoke about his support for alternative energy sources and the need for the US to build highly fuel efficient cars, Mr McCain voiced his backing for offshore drilling and nuclear power.
Key words used most frequently by Senator McCain in the debate
Taking up a hot-button social issue, Mr McCain said his rival had aligned himself with "the extreme aspect of the pro-abortion movement in America", citing a vote by Mr Obama in the Illinois state senate against a ban on late-term abortion.
Mr Obama defended that vote, saying the measure would have undermined Roe v Wade, the landmark ruling granting women rights to abortion.
The debate comes as a new national poll puts Mr Obama ahead by 53% to 39%.
The poll, by the New York Times and CBS News, suggests that Mr McCain's recent turn to negative campaigning has backfired.
The majority of those voters whose opinion of the Republican presidential candidate has gone down cite his attacks on Mr Obama.
The state of the economy now rates as overwhelmingly the most important issue for voters.
Meanwhile, the scale of the economic challenge facing the next president was demonstrated by the news that the US government's budget deficit hit a record high of $455bn in the current financial year that ended on 1 October - even before the cost of the $700bn bail-out is taken into account.
The candidates had been elaborating on their latest economic proposals ahead of the debate.
Mr McCain has proposed an extra $52bn in tax cuts to help retired people whose savings have been hit by the credit crunch, while Mr Obama wants an additional $60bn emergency spending package to help states, the unemployed and companies to create jobs.
Meanwhile, the Republican National Committee (RNC) has said it will halt its advertising in Maine and Wisconsin.
The move suggests that Republican strategists are doubtful about their candidate's chances there, analysts say.
The McCain campaign will continue to run its own ads in the two states, however. Mr McCain was in Wisconsin last week, and running mate Sarah Palin is expected to visit Maine on Thursday.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.