PM Theresa May has struck a last-minute deal with the EU in a bid to move Brexit talks on to the next phase.
There will be no "hard border" with Ireland; and the rights of EU citizens in the UK and UK citizens in the EU will be protected.
The so-called "divorce bill" will amount to between £35bn and £39bn, Downing Street sources say.
The European Commission president said it was a "breakthrough" and he was confident EU leaders will approve it.
They are due to meet next Thursday for a European Council summit and need to give their backing to the deal if the next phase of negotiations are to begin.
Talks can then move onto a transition deal to cover a period of up to two years after Brexit, and the "framework for the future relationship" - preliminary discussions about a future trade deal, although the EU says a deal can only be finalised once the UK has left the EU.
A final withdrawal treaty and transition deal will have to be ratified by the EU nations and the UK Parliament, before the UK leaves in March 2019.
Northern Ireland's Democratic Unionist Party, whose opposition on Monday led to talks breaking down, said there was still "more work to be done" on the border issue and how it votes on the final deal "will depend on its contents". Mrs May depends on the party's support to win key votes in Westminster.
The pound was trading at a six-month high against the euro as news broke of the draft agreement.
What has been agreed?
- Guarantee that there will be "no hard border" between Northern Ireland and the Republic and that the "constitutional and economic integrity of the United Kingdom" will be maintained.
- EU citizens living in the UK and vice versa will have their rights to live, work and study protected. The agreement includes reunification rights for relatives who do not live in the UK to join them in their host country in the future
- Financial settlement - No specific figure is in the document but Downing Street sources say it will be between £35bn and £39bn, including budget contributions during a two-year "transition" period after March 2019
The Irish border - the devil in the detail
The UK government and the EU want to maintain the free flow of goods, without border checks that they fear could threaten a return to The Troubles, but the DUP does not want Northern Ireland to be treated differently to the rest of the UK after Brexit.
The joint EU-UK document says any future deal must protect "North-South co-operation" and hold to the UK's "guarantee of avoiding a hard border".
The agreement also says "no new regulatory barriers" will be allowed between Northern Ireland and the rest of the UK, and that Northern Ireland's businesses will continue to have "unfettered access" to the UK internal market - a passage thought to have been added to meet DUP concerns.
But it also sets out a fallback position if the UK fails to agree a trade deal. This could prove controversial because it says there will continue to be "full alignment" between the EU and Northern Ireland on some elements of cross-border trade, as set out in the Good Friday Agreement.
The DUP would have preferred this not to be in the agreement, says the BBC's Chris Morris, and there could be some hard negotiating to do further down the line.
Citizens' rights - same for everyone?
Agreement has been reached on what happens to the three million EU citizens living in the UK and more than a million UK citizens in EU states after Brexit.
EU citizens currently in the UK would be allowed to continue living and working there - and those already in the country who do not yet have permanent residency would be able to acquire it after Brexit.
Freedom of movement could continue for two years after March 2019, although the UK says new arrivals will have to register.
The plan is that UK citizens in living in an EU country would get the same rights, although they would not retain them if they moved to another EU country.
For eight years after Brexit, UK courts will be able to refer cases involving EU nationals to the European Court of Justice for interpretation.
But the campaign group the 3million, which represents EU citizens in the UK, said there was "still no clarity around the registration criteria for these rights" and said of the eight years: "Our rights should not have an expiry date".
The divorce bill - a figure at last
A figure is not mentioned in the text of the agreement but Downing Street sources says it will be between £35bn and £39bn. It will be paid over four years and the precise figure is unlikely to be known for some time.
EU Brexit negotiator Michel Barnier said the EU had agreed to drop the cost of relocating UK-based EU agencies from the final divorce bill.
The prime minister said it would be "fair to the British taxpayer" and would mean the UK in future "will be able to invest more in our priorities at home, such as housing, schools and the NHS".
What happens next?
Technically a future trade deal cannot be signed while the UK remains a member of the EU but "preliminary and preparatory discussions" can begin.
But the EU's chief Brexit negotiator Michel Barnier has said the withdrawal treaty and transition deal need to be ready by October 2018 - in order that they can be ratified by March 2019, before the "real negotiation" begins on the future relationship.
Mr Barnier suggested on Friday that the only option for a future trade arrangement was a Canada-style deal, rather than a one based on Norway, which retains free movement and unrestricted access to the single market but pays into the EU budget.
The European Council wants the UK to remain a "member" of the EU's customs union and single market and to remain under the full jurisdiction of the European Court of Justice during the transition period, according to a leaked document.
What has changed since Monday?
The DUP, whose opposition on Monday led to talks breaking down, say there have been six "substantial changes" to the text.
Party leader Arlene Foster said they would mean there was "no red line down the Irish Sea" - meaning no customs barrier between Northern Ireland and the rest of the UK.
But BBC Northern Ireland economics editor John Campbell says there is a lot of hard negotiating to come and compromises to be made.
Another interpretation of the deal is that that it still leaves the door open for a special status for Northern Ireland, he adds.
BBC political editor Laura Kuenssberg's analysis
The prime minister made her decisions on Thursday night while the No 10 Downing Street Christmas party carried on.
It isn't celebration on Friday though for her government, but relief.
How has it been received?
Theresa May's cabinet colleagues heaped praise on her, with Environment Secretary Michael Gove saying it was a "significant personal political achievement" for Mrs May while Foreign Secretary Boris Johnson tweeted: "Congratulations to PM for her determination in getting today's deal."
But Labour's Brexit spokesman Sir Keir Starmer said Mrs May should "seriously reflect on her approach to the negotiations so far".
He added: "Despite being two months later than originally planned, it is encouraging that the European Commission has recommended sufficient progress in the Brexit negotiations."
DUP Leader Arlene Foster said it meant that Northern Ireland would "not be separated constitutionally, politically, economically or regulatory from the rest of the United Kingdom" and "in all circumstances the United Kingdom will continue to ensure the same unfettered access for Northern Ireland's businesses to the whole of the UK internal market".
Scotland's First Minister Nicola Sturgeon tweeted: "Move to phase 2 of talks is good - but the devil is in the detail and things now get really tough."
Lib Dem leader Vince Cable, who backs a referendum on the final deal, said "it reduces the risk of a catastrophic no-deal Brexit" but questioned if it would last or be "torn apart by Theresa May's own MPs".
Former UKIP leader Nigel Farage told the BBC the estimated bill was "way more than we need to pay" and he was unhappy that the European Court of Justice would continue to have a role for up to eight years. "The whole thing is humiliating. We have collapsed at every level."