Britain and the European Union reached a last-ditch Brexit deal on Thursday, just hours before an EU summit that is expected to give it a seal of approval.
But Prime Minister Boris Johnson will still have to take the accord to a sceptical British parliament for its backing on Saturday, and it is far from certain that it will pass.
Johnson, who has pledged to take Britain out of the EU with or without an agreement, tweeted: "We've got a great new deal that takes back control - now Parliament should get Brexit done on Saturday."
EU officials are pleased they avoided an immediate crisis at the European Council summit, and European Commission President Jean-Claude Juncker recommended that the other 27 EU leaders endorse the deal.
"Where there is a will, there is a deal -- we have one! It's a fair and balanced agreement for the EU and the UK and it is testament to our commitment to find solutions," Juncker tweeted.
The draft agreement was forged just weeks before Britain was due to leave the bloc on October 31, ending more than four decades of close economic and political ties with its nearest neighbours.
Chief EU negotiator Michel Barnier said: "We have managed to find solutions that fully respect the integrity of the single market.
"We created a new and legally operative solution to avoid a hard border, and protect peace and stability on the island of Ireland," he said.
"It is a solution that works for the EU, for the UK and for people and businesses in Northern Ireland."
One immediate hurdle is opposition from Johnson's allies in Northern Ireland's Democratic Unionist Party (DUP), which pre-emptively rejected the compromise.
The agreement would see the British-ruled province remain under EU customs and Value Added Tax (VAT) rules, and the loyalist DUP announced that it can not support it.
It is not clear how many of Johnson's Conservative MPs will back the deal, and if the British opposition could vote it down or attempt to force a nationwide referendum to approve or reject it.
Before setting off for Brussels, German Chancellor Angela Merkel noted approvingly that London had been ready to negotiate and put "concrete proposals on the table".
- Economic disruption -
Under the measures to replace the so-called "Irish backstop" in the previous failed agreement, the plan would see Northern Ireland remain British legal territory but trade under EU regulations.
This is intended to prevent the return of a hard border with EU-member Ireland. But, because it would involve some customs and tax checks with the rest of the UK, it raised the hackles of the DUP.
EU negotiator Michel Barnier was to give a news conference to outline more details of the deal.
But one EU source told AFP the agreement "is politically fragile in London" because of Johnson's reliance on votes from the DUP and Conservative eurosceptics.
The leaders also hope the summit will rise above the Brexit mire and focus on the EU budget debate, bids by North Macedonia and Albania to start talks to join the bloc, and the crisis in relations with Turkey.
The Brexit issue is first on the agenda, with the EU's 27 other leaders to hear Johnson speak then retire to mull their response. But the issue could be delayed to Friday if the deal text needs more work.