European Council President Donald Tusk has recommended that the EU approve the Brexit deal at a summit on Sunday.
It comes after Spanish PM Pedro Sanchez received assurances from the UK government over Gibraltar, and dropped his threat to boycott the summit.
He said he had received the written guarantees he needed over Spain’s role in the future of the British territory.
UK Prime Minister Theresa May flies into Brussels later to hold talks with top EU officials, ahead of the summit.
Meanwhile, former UK Foreign Secretary Boris Johnson said the UK would become a “satellite state” under the deal.
Spain had raised last-minute objections ahead of the summit about how the issue of Gibraltar had been handled in the Brexit talks so far.
But EU leaders secured a compromise with the Spanish prime minister, who said that Europe and the UK “had accepted the conditions set down by Spain” and so would “vote in favour of Brexit”.
Mr Tusk said he recommended “that we approve on Sunday the outcome of the Brexit negotiations” in a letter to members of the European Council.
He added: “No-one has reasons to be happy. But at least at this critical time, the EU 27 has passed the test of unity and solidarity.”