Obama had pledged a phased withdrawal of US troops over a 16-month period if elected president in November's elections, while McCain has said he wants US troops to remain in the country until success is assured.
'Priming the pump'
Obama held a second news conference later on Thursday in the US state of North Dakota to clarify his comments, in which he said he saw no information that "contradicts" his plans for pulling out one or two brigades a month if elected.
He said that was "the same position" that he had held for the past year.
"My first day in office, I will bring the joint chiefs of staff in, and I will give them a new mission, and that is to end this war. Responsibly, deliberately, but decisively."
Obama also blamed McCain's camp for misrepresenting his words to the media, saying they had "primed the pump" with the press "to suggest that somehow we were changing our policy, when we hadn't".
McCain's camp countered that Obama's comments were the latest in a series
of policy reversals over issues such as capital punishment, gun control, religion
and foreign policy.
"Now that Barack Obama has changed course and proven his past positions to be just empty words, we would like to congratulate him for accepting John McCain's principled stand on this critical national security issue," Brian Rogers, a spokesman for the Arizona senator, said in a statement on Thursday.
"If he had visited Iraq sooner or actually had a one-on-one meeting with General [David] Petraeus, he would have changed his position long ago," he said, referring to the top US commander in Iraq.
McCain visited Iraq in March this year for talks with US military officials and Iraqi politicians.