WASHINGTON (CNN) -- In their first head-to-head debate, Sen. John McCain criticized Sen. Barack Obama as a candidate who "doesn't understand" the key issues the country faces, and Obama linked McCain to President Bush on several issues.

"I'm afraid Sen. Obama doesn't understand the difference between a tactic and a strategy," McCain said Friday as the two traded jabs over Iraq.

Obama shot back, "I absolutely understand the difference between tactics and strategy. And the strategic question that the president has to ask is not whether or not we are employing a particular approach in the country once we have made the decision to be there."

McCain drew from his experience overseas as he tried to portray himself as the more qualified candidate.

"Incredibly, incredibly Sen. Obama didn't go to Iraq for 900 days and never asked for a meeting with Gen. [David] Petraeus," he said. Watch McCain, Obama talk about fighting in Iraq »

McCain slammed Obama for not supporting the surge, an increase of about 30,000 troops to Iraq in early 2007. Bush sent the additional troops as part of a campaign to pacify Baghdad and its surrounding provinces.

"John, you like to pretend like the war started in 2007," Obama shot back. "You talk about the surge. The war started in 2003, and at the time when the war started, you said it was going to be quick and easy. You said we knew where the weapons of mass destruction were. You were wrong." Watch entire debate: Part 1 » | Part 2 » | Part 3 »

Obama repeatedly criticized the Bush administration and charged that McCain is an endorser of his policies. See scenes from the debate »

In describing his tax plan, Obama said, "over time, that, I think, is going to be a better recipe for economic growth than the -- the policies of President Bush that John McCain wants to -- wants to follow."

Obama also said the economic crisis is the "final verdict on eight years of failed economic policies promoted by George Bush, supported by Sen. McCain."

Both candidates squeezed in a few cheap shots. Obama brought up McCain's jokingly singing a line about bombing Iran, and McCain jabbed Obama for his short-lived "presidential seal."

Immediately after the debate, both campaigns issued statements declaring their candidate the winner. Grade the candidates' performance in the debate

"This was a clear victory for Barack Obama on John McCain's home turf. Sen. McCain offered nothing but more of the same failed Bush policies, and Barack Obama made a forceful case for change in our economy and our foreign policy," said Obama-Biden campaign manager David Plouffe.

"John McCain needed a game-changer tonight, and by any measure, he didn't get it," he said. iReport.com: Who do you think won the debate?

McCain's campaign said "there was one man who was presidential tonight; that man was John McCain."

"There was another who was political; that was Barack Obama. John McCain won this debate and controlled the dialogue throughout, whether it was the economy, taxes, spending, Iraq or Iran. There was a leadership gap, a judgment gap and a boldness gap on display tonight, a fact Barack Obama acknowledged when he said John McCain was right at least five times," communications director Jill Hazelbaker said. Full coverage of the debates

During the first 30 minutes of the debate, the candidates focused on the economy, even though the debate was supposed to be centered on foreign policy.

For a while, it seemed like the debate might not even take place, because McCain said he would not show up unless Congress came to an agreement on the government's proposed $700 billion bailout plan.

McCain said Friday that enough progress has been made for him to attend the debate, even though Congress has not made a deal.

Here's a snapshot of what the candidates said.

On government spending:

McCain said he would consider a spending freeze on everything but defense, veterans affairs and entitlement programs in order to cut back on government spending.

Obama disagreed, saying, "The problem is, you're using a hatchet where you need a scalpel.

"There are some programs that are very important that are currently underfunded," Obama said.

He agreed that the government needs to cut spending in some areas, but he said other areas, such as early childhood education, need more funding.

McCain repeated his call to veto every bill with earmarks. Watch the candidates spar over earmarks »

Obama said the country "absolutely" needs earmark reform but said, "the fact is, eliminating earmarks alone is not a recipe for how we are going to get the middle class back on track."

On the bailout proposal:

Obama said that the United States was facing its worst financial crisis since the Great Depression.

McCain said he was encouraged that Republicans and Democrats were working together to solve the crisis.

Obama refused to be pinned down on whether he would support a $700 billion plan proposed by President Bush's top economic advisers, saying the final details of the proposal were not known.

McCain said he hoped to be able to vote for it.

On the likelihood of another terrorist attack:

McCain that another attack on the scale of the September 11 hijackings is "much less likely" now than it was the day after the terrorist attacks.

"America is safer now than it was on 9/11," he said, "But we have a long way to go before we can declare America safe."

Obama agreed that the United States is "safer in some ways" but said the country needed to focus more on issues such as nuclear non-proliferation and restoring America's image in the world.

On relations with Russia:

Obama called for a re-evaluation of the United States' approach to Russia in light of the country's recent military action in the Caucasus.

"You cannot be a 21st-century superpower and act like a 20th-century dictatorship," he said.

McCain accused Obama of responding naively to Russia's invasion of neighboring Georgia last month by calling on both sides to exercise restraint.

McCain said he would support the inclusion of Georgia and Ukraine in NATO.

On Iran:

McCain said Iranian nuclear weapons would be an "existential threat to the state of Israel" and would encourage other countries in the Middle East to seek nuclear weapons as well.

"We cannot allow another Holocaust," he said.

Obama agreed that the United States "cannot tolerate a nuclear Iran," calling for tougher sanctions from a range of countries including Russia and China.

McCain called for a new "league of democracies" to stand firm against Iran.

On Iraq:

McCain said the next president will have to decide when and how to leave Iraq and what the United States will leave behind.

The Republican candidate said that the war had been badly managed at the beginning but that the United States was now winning, thanks to a "great general and a strategy that succeeded."

"Sen. Obama refuses to acknowledge that we are winning in Iraq," McCain said.

Obama responded, "that's not true; that's not true."

He blasted McCain as having been wrong about the war at the start, saying McCain had failed to anticipate the uprising against U.S. forces and violence between rival religious groups in the country. Watch Obama tell McCain he was 'wrong' »

"At the time when the war started, you said it was quick and easy. You said we knew where the weapons of mass destruction were," Obama said, citing the key White House policy justifying the 2003 invasion.

"You were wrong. You said that we were going to be greeted as liberators. You were wrong," he said.

All About Barack Obama • John McCain • U.S. Presidential Election