The Spanish leader did not say what the deal involved but told reporters at an EU summit in Brussels: “It is already resolved, it is already closed with the British government.
“Gibraltar is not going to be a problem in reaching an agreement on Brexit,” he said.
Confiamos en avanzar en un acuerdo común e impulsar la negociación en torno #Brexit y Gibraltar en un clima constructivo, que fortalezca a Europa. Así lo he hablado con la PM @theresa_may a la llegada del #EUCO. pic.twitter.com/suP15EO6NH
— Pedro Sánchez (@sanchezcastejon) October 18, 2018
The rocky outcrop on the coast of southern Spain has belonged to Britain since 1713 but is regularly claimed by Madrid.
In April 2017, the EU agreed to give Spain the right to veto any future post-Brexit relationship between the 27-member bloc and Gibraltar.
The bloc's negotiating guidelines stated that “no agreement” after Brexit between the EU and Britain could apply to Gibraltar without a bilateral agreement between Madrid and London.
Spain has nevertheless tried to reassure the territory's inhabitants that it will not use the negotiations to try and get it back nor to make their lives more complicated.
While Gibraltar may be agreed, the wider Brexit talks are stalled over disagreement about how to keep open Britain's land border with Ireland and the EU.