The Spanish Foreign Office expressed its "upset and concern" over the planned visit to the Rock, a British territory that sits at the foot of Spain's southwestern corner, to Giles Paxman, the British Ambassador to Madrid.
The subject was raised during a recent scheduled meeting with the British diplomat and Santiago Cabanas Ansorena, Spain's foreign policy director.
The Royal visit is scheduled for June 11-13 when Prince Edward and his wife will take part in a series of events to mark the Queen's 60 years on the throne.
The complaint follows the usual stance taken by Spanish authorities over such visits. In 2009, similar protests were made over a visit by Princess Anne to the British Overseas Territory.
When the Prince of Wales visited Madrid on an official visit in April last year, the Spanish heir to the throne raised the centuries old dispute and urged for a solution to be found.
Spain ceded Gibraltar to Britain in 1713 under the Treaty of Utrecht but has long argued that it should be returned to Spanish sovereignty.
The Rock, which boasts a Marks and Spencer, traditional English pubs, bobbies on the beat and red telephone boxes, is home to 28,000 Gibraltarians, who in a 2002 referendum overwhelmingly rejected a deal to share sovereignty between the two nations and demanded to remain a part of Britain.
Spain is arguably not so upset about the forthcoming visit that they have asked Queen Sofia to refuse an invitation to lunch with Queen Elizabeth at an event to mark the jubilee at Windsor Castle next week.
King Juan Carlos and Queen Sofia refused to attend the 1981 wedding of the Prince of Wales and Diana in protest that the couple had elected to begin their honeymoon with a visit to Gibraltar.