Spanish prime minister, Pedro Sánchez, last week promised that Spain and the UK would reach an agreement over Gibraltar, in the context of Brexit, by the middle of October.
Speaking after the EU leaders' summit in Salzburg, he signalled that there were still "complications" in discussions with the British government but expressed "the will" of both sides.
The "complications" in the negotiations are disagreements over "judicial and police cooperation as well as the environment and tax" and " tobacco", listed Sánchez, who also said that he wanted a socioeconomic commitment from Gibraltar to help develop the Campo de Gibraltar area of Spain.
"We're very near to reaching an agreement," added the PM, saying that the "focus and behaviour of the British government is very constructive".
"I think that we can reach an agreement in October," he said.
In parallel, the Gibraltar government has complained that a Guardia Civil patrol boat entered a security zone in waters around the peninsula last Thursday as a Royal Navy submarine was leaving. A British vessel let off a warning flare.
A planned summit in Brussels on 18 October over Brexit is seen as a crunch point in negotiations with the possibility of a further summit between EU leaders in November if needed.