The incumbent President said the former Massachusetts governor had been "all over the map" in his positions on major foreign policy issues.
"Every time you have offered an opinion you have been wrong," he said.
"You said we should have gone into Iraq, despite the fact there were no weapons of mass destruction. You said we should still have troops in Iraq to this day. You said we shouldn't be passing nuclear treaties with Russia."
Mr Romney, meanwhile, accused Mr Obama of failing to tackle Islamic extremism and missing opportunities presented by the Arab Spring.
"I congratulate him on taking out Osama bin Laden and going after the leadership of al Qaeda, but we can't kill our way out of this mess," he said.
[Related article: Obama's "horses and bayonets" debate zinger goes viral]
He said Mr Obama had sent out the wrong message by embarking on an "apology tour" of the Middle East during which he said the US had at times dictated to other nations, a charge dismissed by the President as a "big whopper".
The Republican challenger also said he would take a tougher line on Iran, singling out the country's controversial nuclear programme as the greatest threat to US security.
"I think from the very beginning, one of the challenges we've had with Iran is that they have looked at this administration and felt that the administration was not as strong as it needed to be," he said.
"We're four years closer to a nuclear Iran and we should not have wasted these four years."
Mr Obama committed to stand with Israel against threats from Iran or any other nation, but said terrorist networks were the principal concern for national security.
He highlighted his administration's change of focus of attention to "those who actually killed us on 9/11", saying that under this strategy "al Qaeda's core leadership has been decimated".
The President also dismissed claims he had run down the armed forces to levels not seen since the early 20th century.
"You mentioned the navy, for example, and that we have fewer ships than we did in 1916. Well, governor, we also have fewer horses and bayonets because the nature of our military's changed," he said to laughter from the audience.
The heated debate at Lynn University in Boca Raton, Florida, repeatedly strayed into domestic policy, with Mr Romney arguing that national security depends on a strong economy.
Going into the debate the candidates were neck-and-neck after the Romney campaign was boosted by good performances in the first two clashes.
A poll taken by CBS immediately afterwards suggested voters thought Mr Obama had performed best in Boca Raton, by 53% to 23%.
Both men will now embark on two weeks of whirlwind campaigning.
Mr Obama is due to speak in six states during a two-day trip that begins on Wednesday, while Mr Romney is expected to visit two or three states a day.