Madrid is also mulling presenting a united front with Argentina, which is immersed in its own dispute with Britain over the sovereignty of the Falkland Islands, over the issue of Gibraltar, the spokesman added.
"We are evaluating the possibility of going to bodies like the United Nations, the Security Council, the court in The Hague. They are possibilities. No decision has been taken," the spokesman said.
Spain could team up with Argentina, which is on a two-year term as non-permanent member of the UN's Security Council, to address the issue of the sovereignty of Gibraltar and the Falkland Islands, or the Malvinas as they are known in Spanish, in international bodies, he added.
"That is also being evaluated. There are common elements in the issue of Malvinas and Gibraltar and elements that are more distant," he added.
Spain ceded Gibraltar to Britain in perpetuity in 1713 under the Treaty of Utrecht but has long argued that it should be returned to Spanish sovereignty.
London says it will not do so against the wishes of Gibraltarians — who are staunchly pro-British.
Tensions over the territory rose last month after Gibraltar dropped 70 concrete blocks into the contested waters off its coast with the aim of creating an artificial reef.
Madrid accuses Gibraltar of creating the reef to prevent Spanish fishermen from casting their nets in the waters around the British territory ans has responded by beefing up border controls with Gibraltar, causing lengthy tailbacks of cars.
A handful of British warships began setting sail for the Mediterranean on Monday on what the defence ministry stresses is a routine exercise that was planned months ago.
But one of the ships is set to dock in Gibraltar later this week in a move that is being reported by some Spanish media outlets as an act of intimidation.
Meanwhile a spokesperson for British Prime Minister David Cameron said London was considering taking legal action against Spain over the stringent border checks.
The spokesman said legal action over the checks by Spanish guards, which have caused tailbacks of several hours at the border of the British-held territory, would be "an unprecedented step".