“This is an agreement that we have been negotiating for several months now with the United Kingdom in the field of security and defence,” Foreign Minister Arancha Gonzalez Laya told Canal Sur radio.
The aim was to establish a framework to cover everything from the fight against terror groups, to cybersecurity and joint military missions, with Spain also hoping it will include “confidence measures” in Gibraltar.
“We want to have a framework that encompasses these security and defence ties,” she said.
“Our collaboration is very broad and what we want is to provide an umbrella for this partnership which is as broad as possible that also strengthens our bilateral relationship in the future.”
But Spain, whose troops serve alongside their British counterparts in NATO and UN missions, also wants it to touch on Gibraltar where the occasional presence of British nuclear submarines has triggered several diplomatic rows.
In May 2000, Britain's HMS Tireless was forced to dock in Gibraltar for repairs for nearly a year after a crack was found in a cooling pipe near its nuclear reactor.
Its presence caused outrage in Gibraltar and southern Spain, where there were regular protests over fears of a leak.
A similar incident occurred in July 2016 when another British nuclear submarine briefly docked in Gibraltar after colliding with a merchant vessel nearby.
Asked whether the agreement would mean British nuclear submarines would no
longer be able to dock in Gibraltar without Spain being informed, Gonzalez Laya did not say.
“What is certain is that we would like there to be some confidence-building measures, let's say, so that situations like those that occurred in the past do not happen again here,” she said.
The tiny rocky outcrop of Gibraltar has long been the subject of an acrimonious sovereignty row between both countries.
News of the talks emerged just days after London and Madrid reached an agreement that will see Gibraltar included in the European Schengen zone to keep movement fluid on its border in a landmark deal just hours shy of the final Brexit deadline.