Prime Minister Mariano Rajoy said Spain will take "legal and proportional steps" after Britain sent a rapid reaction force of warships to visit the island's waters.

Mr Rajoy's comments appear to echo the language of the United Nations Charter, which uses the phrase "all necessary measures" to authorise the use of military force.

Tension between Britain and Spain over Gibraltar's sovereignty have intensified following a row over fishing rights and the imposition of punitive border checks.

Britain is sending a force of nine vessels, led by the helicopter carrier HMS Illustrious and including two frigates, to sail for the Mediterranean on Monday for the start of a four month deployment. Three of the ships, including HMS Westminsters, will actually dock in Gibraltar.

Naval chiefs stressed the visit by the nine-vessel Response Force Task Group was part of a long-planned exercise, and not in response to the diplomatic row.

Mr Rajoy said:"We will take legal measures which are proportionate to defend the interests of Spaniards," he said.

“I hope that this issue goes no further, but Spain has to defend its national interests and that is what we are going to do."

He said Spain reserve the right to continue border checks which have left people waiting up to seven hours to get into Gibraltar, and suggested Britain should act with "common sense and good judgement".

"We can and should carry out border controls like the ones which we have carried out in recent days," he said.

The force of four Royal Navy warships supported by five ships of the Royal Fleet Auxiliary is led by the helicopter carrier HMS Illustrious. It will consist of thousands of sailors and Royal Marines.

The deployment, called Cougar 13, will see the force sail through the Mediterranean and on to The Gulf and Horn of Africa, holding joint exercises with navies along the way.

David Cameron earlier this week said he was “seriously concerned” about escalating tensions over the border between Spain and Gibraltar.

The escalation between Spain and the British territory began last month after Gibraltar began building an artificial reef it said would improve fish stocks depleted by incursions by Spanish fishermen.

Downing Street’s claims that Spain had agreed to ease punitive border delays after a call between David Cameron and Mariano Rajoy, the Spanish Prime Minister, appeared premature after Spanish police quickly re-imposed them.

Those entering the Rock quickly found themselves in queues of up to four hours in the hottest part of the day.

Gibraltar’s chief minister, who earlier in the week likened Spain’s stance to “that of North Korea”, said the latest behaviour was just another example of Spanish “duplicity”.

“It’s about time the UK government saw the face of Spain that we see constantly. In Gibraltar we are not so surprised that there was an element of duplicity in the way Spain is going about this,” Mr Picardo said on Thursday.

Following the call between Prime Ministers, Downing Street briefed that Spain had conceded to reduce measures at the border while agreeing the Gibraltar issue should “not become an obstacle in bilateral relations” and that there was a “need to find a way to de-escalate”

However, the Spanish government issued a statement in which it made no reference to any concessions to reduce delays at the border and claimed instead that Mr Rajoy had held his ground over the matter.

“From the two such diametrically opposed briefings from two capitals, it seemed that two entirely different conversations were held,” commented Gibraltar’s Chief Minister.

The front pages of Spanish newspapers on Thursday carried headlines on the “stand-off”.

“There is an obvious defiance displayed on front pages of all the Spanish newspapers today,” said Mr Picardo. “It remains to be seen whether we are going to see that defiance played out on the ground or whether in fact they will talk tough but deliver on de-escalation that the prime minister has sought.”

He commented that perhaps it suited Spain’s ruling Popular Party to keep Gibraltar in the headlines for a few more days yet.

“There is certainly a smoke screen element to all this and the best way for Spanish government to play out August is to have Gibraltar on the front pages and not the scandals that are afflicting them.”

A spokesman for the Ministry of Defence said the annual Cougar deployment was “long-planned and well-established”.

He said: “Gibraltar is a strategic base for UK Defence and as such Royal Navy ships visit its waters throughout the year as part of a range of regular and routine deployments.

“Elements of last year’s Cougar ’12 deployment visited Gibraltar and the forthcoming visit by ships making up Cougar ’13, including HMS Westminster and the Royal Fleet Auxiliary ships Lyme Bay and Mounts Bay, are business as usual. At the same time, other elements of the Task Force will be visiting Spanish ports as part of the exercises.

“The same phase of the deployment will also see port visits in Portugal and throughout the Mediterranean to Spain, Turkey and Malta before onward transit to the Middle East.”