Madrid: Spain on Thursday announced an "agreement in principle" with the United Kingdom on Gibraltar, which will keep the tiny British territory's border open.
This came after an 11th-hour breakthrough in protracted negotations, hours before the UK's economic and practical departure from the European Union.
Gibraltar wasn’t part of the Brexit trade deal between the EU and the UK, which was announced on Christmas Eve.
"After the withdrawal of the United Kingdom from the European Union, today is the beginning of a new relationship," said Spanish Foreign Minister Arancha Gonzalez Laya.
She added that Gibraltarians and residents of neighboring Spanish Campo de Gibraltar could "breathe a sigh of relief".
The deal means that The Rock, whose sovereignty is disputed by Spain and Britain, will remain subject to rules in use in Europe's border-free Schengen area.
Read: Harris on citizenship for undocumented people
Britain is not part of that area.
That area consists of about two dozen nations who have agreed to eliminate general travel checks between them.
The agreement between Spain and the UK will now be sent to Brussels, where the European Commission will enter into negotiations with London to turn it into a treaty, Gonzalez Laya said.
She said she expected the treaty to be signed within six months.
The British Foreign Office made no immediate comment.
AP