John McCain and Barack Obama battled in the shadow of the US finance crisis on Friday in a first presidential debate crackling with sharp disputes over the economy, Iraq and terrorism.
Democrat Obama, 47, vying to make history as America's first black president, branded McCain as a inheritor of President George W. Bush's unpopular legacy of "failed" economic and foreign policies.
Republican McCain, 72, presented himself as a reformer and posed as a superior potential commander-in-chief, repeatedly saying Obama did not "understand" foreign policy threats or was "naive" in his outlook to the world.
"I don't think I need any on-the-job training. I'm ready to go at it right now," McCain, 72, said.
Both candidates avoided major gaffes in a spirited debate, taking place at a time of deep national peril with the Wall Street crisis threatening to ruin the US economy and millions of working class jobs.
Obama came across as polished and well briefed, and seemed to meet the threshold many analysts set for him going in as a credible future leader of the United States.
McCain steered clear of errors that could be chalked up to his age, looked focused and engaged in the debate, mostly on foreign policy, which both sides see as his strong point.
Obama said the current financial crisis was "the final verdict on eight years of failed economic policies promoted by George Bush, supported by Senator McCain" and lashed his rival for saying the US economy was fundamentally "strong."
"I just fundamentally disagree," he said.
McCain said Obama has "the most liberal voting record in the Senate. It's hard to reach across the aisle from that far left," he said, warning Obama's tax plans would hamper growth.
He presented himself as a champion of reform and scourge of wasteful spending, and defended his sudden return to Washington to deal with the financial meltdown.
The Republican had only agreed to take part about 10 hours before the debate, after calling for it to be delayed over the finance crisis, a move Democrats branded as a stunt by a desperate campign.
Less than 40 days before election day on November 4, differences over the war in Iraq festered throughout the debate on a red carpeted stage at the University of Mississippi.
Obama, who has a small lead in most national opinion polls, claimed credit for opposing the invasion in 2003 and McCain said he had been instrumental in pushing the successful surge strategy.
"We are winning in Iraq and we'll come home. And we'll come home as we have when we have won other wars and not in defeat," McCain said, accusing Obama of denying the achievements of US troops in the war.
But Obama hit back, saying "six years ago I stood up and opposed this war," condemning McCain for standing with Bush over 2003 US-led invasion to topple dictator Saddam Hussein.
"I wish I had been wrong for the sake of the country and they had been right but that's not the case," Obama said.
"When the war started you said it was quick and easy, you said we knew where the weapons of mass destruction were. You were wrong.
"You said that we were going to be greeted as liberators. You were wrong. You said that there was no history of violence between Shia and Sunni and you were wrong."
But McCain went on the attack over Obama's offer to offer dialogue to Iran.
"It isn't just naive, it is dangerous," McCain, warning that a nuclear armed Tehran threatened a "second Holocaust."
Obama agreed a nuclear Iran would be a "gamechanger" and urged tougher sanctions. But he also defended his call for diplomacy.
"We also have to engage in tough, direct diplomacy with Iran," Obama said, adding he would reserve the right as president "to meet with anybody at a time and place of my choosing if I think it's going to keep America safe."
Obama defended his vow to launch military attacks on extremists in Pakistan if Islamabad was unwilling or able to act, prompting a rebuke from McCain : you don't say that out loud."
But Obama responded by recalling an unguarded moment by McCain months ago on the campaign trail in Iowa.
"Coming from you, who, you know, in the past has threatened extinction for North Korea and sung songs about bombing Iran, I don't know how credible that is."
McCain also accused Obama of being wrong about resurgent Russia, saying the Illinois senator had been too soft on Moscow over the showdown with Georgia.
"Again, a little bit of naivete there, he doesn't understand Russia committed serious aggression against Georgia," McCain said.