Theresa May is facing a fresh threat to her Brexit deal after Spain warned it would reject it unless Madrid were granted a special veto to prevent any future EU trade agreement with Britain that covers Gibraltar.

As the EU’s chief negotiator, Michel Barnier, sought to sell the withdrawal agreement to both its critics in the UK and member states who have expressed concerns, the Spanish foreign minister, Josep Borrell, threw a spanner in the works.

Borrell said his government wanted a clear promise that no future trade or security deals would apply to Gibraltar without Spain’s consent.

“Negotiations between the UK and the EU do not apply to Gibraltar. Future negotiations on Gibraltar are separate negotiations,” he said.

“That is what must be made clear. Until we have the future declaration and we know what it says, whether we agree with it or not, we are not going to approve the withdrawal agreement.”

Downing Street and the European commission have a deal in principle on the withdrawal agreement dealing with citizens’ rights, the £39bn divorce bill and the Irish border problem.

The Spanish government wants the accompanying political declaration on the future relationship, which is still being negotiated, to include the veto on the inclusion of Gibraltar, a disputed territory. The socialist government in Spain is facing criticism at home, ahead of regional elections, for being soft on the Gibraltar issue.

“In these negotiations, things always come up at the last moment and that is what we are going to see. I cannot say that things are fixed 100%,” Borrell said. “[Negotiations] may not be so peaceful as they seem. In Europe, it is not over until it’s over. You have always got to be prepared for a surprise at the last minute.”

Gibraltar’s chief minister, Fabian Picardo, said he had received assurances on Monday from Downing Street that the Rock would not be left out of any agreements struck.

He said: “It’s no surprise that we are seeing the Spanish government raise issues at the last minute. The position taken by the Spanish government today does little to build mutual confidence and trust going forward.

“The language of vetoes and exclusions should be the language of the past. It has no place in the modern Europe of today at a time when both the United Kingdom and Gibraltar are trying to build a new positive future relationship with the EU.”

It is understood that Spain raised its objection after realising last Wednesday that one clause in the 585-page draft treaty specifies that the territorial scope of the negotiations will cover Gibraltar as well as other British overseas territories.

Earlier in the day, Barnier had sought to sell the provisional Brexit deal by insisting the UK was now “taking back control” of its laws, in an echo of the Vote Leave campaign slogan, and calling for member states to recognise the progress made amid signs of fracture.

“We are in fact at the decisive moment in this process. No one should lose sight of the progress that has been achieved in Brussels and in London,” Barnier said. “Both the EU and the UK will have full control over their own legislation and rule-making.

“This is essential on our side for the integrity of the single market. It is essential for the UK in terms of taking back control. Now more than ever we must all remain calm, and I will remain calm, and keep on our focus for the UK to leave the EU in an orderly fashion.”

Brussels is preparing for a special Brexit summit next Sunday, where leaders will formally sign off on the withdrawal agreement and the accompanying political declaration on the future relationship, on which negotiations are continuing.

Ministers for the 27 EU member states spoke earlier of their concern about the threat in London to the Brexit deal as they made their final preparations to end “45 years of difficult marriage”.

But member states are also not happy that the UK has been given a customs union in the withdrawal agreement without strict enough conditions to ensure the European economy cannot be undercut.

France is among those that also want a guarantee of a satisfactory agreement for European fishermen who work in British waters possibly in the political declaration, having not achieved that goal in the withdrawal agreement.

The EU is looking at publishing a series of side-declarations to the main political declaration in an attempt to set out its stall on the most contentious areas, in a move that could thwart May’s plans to sell her the package to MPs at home.

France, Italy, the Netherlands, Denmark and Germany, also want tough “level playing field” commitments from the UK, such as dynamic alignment with the EU’s climate change and environment directives.

Alan Duncan, a British foreign minister visiting Brussels, said his colleagues in parliament should be “realistic” when assessing the deal brokered with Brussels, as EU sources warned that reopening agreed texts could lead to a worse deal emerging.

He said: “My message to parliamentary colleagues back in London is: back the prime minister 100%, be realistic that what we need here is a deal that can last for the future, and telling the prime minister what to do all the time is not going to make anything better, so back her 100% and what matters is what is discussed between the UK and the EU, not the voices that are telling the prime minister to do things back in the UK, so let’s be optimistic.”

Gernot Blümel, the EU affairs minister for Austria, which holds the rolling presidency, said of the coming days: “A painful week in European politics is starting. We have the divorce papers on the table. Forty-five years of difficult marriage are coming to an end.”