Spain has lodged a complaint with Britain over the visit next month by the Earl of Wessex to Gibraltar.
Foreign Minister Jose Manuel Garcia-Margallo says the government asked the British ambassador to Madrid for an explanation two days ago and did not receive one.
The ministry then issued a statement expressing its annoyance over the visit to the colony by Edward.
Gibraltar is on Spain's southern tip and has a population of 30,000 people.
Spain ceded Gibraltar's sovereignty to Britain by treaty in 1713 but has persistently sought its return. The Madrid government sees visits by British authorities to Gibraltar as an affront to Spain.
Edward and his wife are to visit Gibraltar on June 11 as part of worldwide events for the Queen's Diamond Jubilee.