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.
Prime Minister Mr Johnson said: "I wholeheartedly welcome today's political agreement between the UK and Spain on Gibraltar's future relationship with the EU.
"The UK has always been, and will remain, totally committed to the protection of the interests of Gibraltar and its British sovereignty."
I wholeheartedly welcome today's political agreement between the UK and Spain on Gibraltar's future relationship with the EU. The UK has always been, and will remain, totally committed to the protection of the interests of Gibraltar and its British sovereignty 🇬🇮🇬🇧
— Boris Johnson (@BorisJohnson) December 31, 2020
Foreign Secretary Dominic Raab added: "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.
Thank you @AranchaGlezLaya for the goodwill and hard-work that helped us reach today's agreement on Gibraltar's future relationship with the EU.
My full statement ⤵️https://t.co/vwQz6oeiV6
— Dominic Raab (@DominicRaab) December 31, 2020
"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 is safeguarded. I am grateful to 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."