Gibraltar's border with Spain will remain open following the end of the Brexit transition period after the UK and European Union agreed a draft deal.
The Rock’s status was not covered in the trade agreement reached by Boris Johnson on Christmas Eve, prompting concerns about what would happen when the transition period ends at 11pm on Thursday.
Gibraltar, whose sovereignty is disputed by Spain and Britain, will remain subject to the rule of the free-travel Schengen area, Spain’s foreign minister said.
Arancha Gonzalez Laya announced that the “agreement in principle” means people in Gibraltar “can breathe a sigh of relief”.
She said that further details on the agreement would be published in the New Year.
Foreign Secretary Dominic Raab said: “Today, working side by side with the Chief Minister of Gibraltar, and following intensive discussions with the Spanish government, we reached agreement on a political framework to form the basis of a separate treaty between the UK and the EU regarding Gibraltar.
"We will now send this to the European Commission, in order to initiate negotiations on the formal treaty.
“In the meantime, all sides are committed to mitigating the effects of the end of the transition period on Gibraltar, and in particular ensure border fluidity, which is clearly in the best interests of the people living on both sides.
“We remain steadfast in our support for Gibraltar and its sovereignty. I am grateful to (Spanish) Foreign Minister Laya and her team for their positive and constructive approach.
"We have a warm and strong relationship with Spain, and we look forward to building on it in 2021.”
Prime Minister Boris Johnson said he “wholeheartedly" welcomes the agreement.
“The UK has always been, and will remain, totally committed to the protection of the interests of Gibraltar and its British sovereignty,” he tweeted.
In the Brexit referendum, 96% of voters in Gibraltar supported remaining in the European Union.
Officials from Madrid and London had until 11pm in the UK - when the Brexit separation comes into force - to find an agreement.
The territory was ceded to Britain in 1713, but Spain maintains its claim to sovereignty over it. That dispute has occasionally flared.