Asked by a Miami radio station if he would meet PM Jose Luis Rodriguez Zapatero, Mr McCain spoke of his record with leaders in "the hemisphere".
His answer led some to suggest he thought Mr Zapatero was Latin American.
Mr McCain's campaign team denied any gaffe, but did say the candidate had refused to commit to a meeting.
Searching for an alternative explanation, some Spanish commentators have suggested Mr McCain may not have forgiven Mr Zapatero for pulling Spanish troops out of Iraq when he became prime minister in 2004.
"If you are elected president, would you be willing to invite Prime Minister Jose Luis Rodriguez Zapatero to the White House to meet with you?"
"I would be willing to meet with those leaders who are our friends and who want to work with us in co-operative fashion," Mr McCain answered, before moving on to talk about US relations with Mexico.
In an effort to draw an answer, the Caracol Miami reporter posed the same question three more times.
Mr McCain gave more or less the same response, saying at one stage: "All I can tell you is that I have a clear record of working with leaders in the hemisphere that are friends with us and standing up to those who are not.
"And that's judged on the basis of the importance of our relationship with Latin America and the entire region."
But Mr McCain's answer has itself posed more questions.
Did Mr McCain forget which country Mr Zapatero leads? Did he misunderstand or mishear the question? Or was he intentionally signalling a cooling in the relationship between Spain and the US?
Mr McCain's foreign policy adviser, Randy Sheunemann, said that there was no doubt about the senator's answers.
"The questioner asked several times about Senator McCain's willingness to meet Zapatero, and identified him in the question, so there is no doubt Senator McCain knew exactly to whom the question referred," he wrote in an email to the Washington Post.
"Senator McCain refused to commit to a White House meeting with President Zapatero in this interview," he confirmed.
In the interview McCain seems to lump Spanish President Zapatero with latin-American leftists such as Hugo Chavez (this is particularly odd because Zapatero has been outspokenly anti-Chavez). McCain clearly seems confused during the interview, probably not realizing what what the interviewer is asking. Most commentators have assumed McCain misheard, which seems plausible enough. My guess is McCain's mind wandered during the question, or else he missed the mention of Spain, and did not know off the top of his head who Zapatero is, and assumed him another latin leftist because all the previous question had been on the topic of anti-American governments in South America.
What happened next is what worried me. Instead of simply admitting the error, McCain advisor Randy Schuenemann e-mailed the Washington Post saying the snub had been deliberate.
It wouldn't surprise me if Schuenemann, a die hard neo-conservative, truly felt what the US ought to snub Spain. If you recall, US conservatives accused Spain's government of appeasement after voting for Zapatero and withdrawing troops shortly after the Madrid train bombings. Never mind that Zapatero's pledge to withdraw troops far predated the attacks and the Spanish public was as much reacting to the right-wing People's Party's craven and ridiculous attempt to blame the train bombing's on the the Baque separatist group ETA.
What is most worrying about this is how ready the McCain campaign was to provoke a minor spat with a NATO ally simply to cover-up a gaffe.
Randy Scheunemann would rather further inflame Spanish-American relations by ridiculously insisting that McCain knew exactly what he saying than admit the obvious -- that he didn't understand the question. It wouldn't be that surprising. But given McCain has premised his whole campaign on foreign policy experience they've clearly decided it would simply be too damaging to admit he was either a) confused, b) ignorant or c) reckless enough to spout off aggressive remarks when he didn't even know who he was being asked about.