Foreign Minister Jose Manuel Garcia-Margallo says Thursday the government has 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 by the British royal.
Gibraltar is located 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.
Prince Edward and his wife are to visit Gibraltar on June 11 as part of worldwide events for Queen Elizabeth II's Diamond Jubilee.