Britain's Prime Minister Boris Johnson and the president of the European Commission, Jean-Claude Juncker, have hailed their new Brexit deal as a "fair and balanced agreement".
But the draft deal, which was announced just hours before a crucial summit in Brussels, now needs to be approved by both UK and European parliaments — something that could prove very difficult.
• Brexit breakthrough? Negotiators agree on an outline Brexit deal
• Hopes fade for Brexit deal at summit as EU needs 'more time'
• Joe Hildebrand: The one thing everybody missed in Brexit chaos
The ultimate test will be when Johnson takes the deal to the House of Commons on Saturday, where former PM Theresa May's deal was rejected three times.
"I think this deal represents a very good deal both for the EU and for the UK. It's a reasonable, fair outcome and reflects the large amount of work that's been undertaken by both sides," Johnson told reporters at a joint press conference with Junker.
"It means that we can deliver a real Brexit that achieves our objectives and it means the UK leaves whole and entire on October 31st.
"I hope very much now that my fellow MPs in Westminster, do now come together to get Brexit done, to get this excellent deal over the line and to deliver Brexit without any more delay, so we can focus on the priorities of the British people."
News of the deal broke on Thursday morning (local time) when Junker announced on Twitter "where there is a will, there is a deal — we have one!"
A tweet from Johnson quickly followed, saying a "great new deal" had been brokered.
Junker then wrote to the president of the European Council, Donald Tusk, asking him to endorse the deal.
"As I have indicated to you in the past, I believe it is high time to complete the withdrawal process and move on, as swiftly as possible, to the negotiation on the European Union's future partnership with the United Kingdom," he said.
But all hopes of a swift agreement in Britain were promptly hammered down by Northern Ireland's Democratic Unionist Party (DUP), which said it was still opposed to the deal.
"We have been involved in ongoing discussions with the government. As things stand, we could not support what is being suggested on customs and consent issues and there is a lack of clarity on VAT," leader Arlene Foster said in a statement.
"We will continue to work with the government to try and get a sensible deal that works for Northern Ireland and protects the economic and constitutional integrity of the United Kingdom."
Without the support of the DUP's 10 politicians, Johnson may struggle to get his deal ratified.
Labour leader Jeremy Corbyn also called on MPs to reject the deal.
"From what we know, it seems the prime minister has negotiated an even worse deal than Theresa May's, which was overwhelmingly rejected," he said.
"This sell-out deal won't bring the country together and should be rejected. The best way to get Brexit sorted is to give the people the final say in a public vote."
WHAT DOES THE DEAL SAY?
The EU's chief negotiator Michel Barnier said the deal rested on four main elements.
Firstly, Northern Ireland will remain aligned to "a limited set of EU rules" notably related to goods. "This means that all applicable procedures on goods will take place at the points of entry into Northern Ireland and not across the island," he said.
Secondly, Northern Ireland will remain in the UK's customs territory. "It will therefore benefit from the UK's future trade policy, but will also remain an entry point into our single market," he said.
Thirdly, the two sides will agree to "maintain the integrity of the single market" while also satisfying the UK's "legitimate wishes" regarding value-added tax (VAT).
And finally, Northern Ireland representatives will be able to decide whether to continue applying the EU rules after four years.
On Twitter, Johnson added the "anti-democratic backstop" had been abolished and the people of Northern Ireland would be in charge of their laws.
WHAT HAPPENS NOW?
Johnson will now take the deal to the House of Commons for final approval on Saturday, hoping to ensure an orderly departure on October 31.
If he cannot secure a deal, a law passed by MPs in September will require him to ask the European Union for another extension.
But Junker said there would be no need for another delay, now a deal was on the table.