The European Commission has announced that "sufficient progress" has been made in the first phase of Brexit talks.
The announcement came after Theresa May and David Davis made an early-hours journey to Brussels to meet with European Commission President Jean-Claude Juncker and the European Union's chief Brexit negotiator Michel Barnier.
It followed talks which continued into the early hours between the Prime Minister and Democratic Unionist Party, Arlene Foster, whose party scuppered a deal at the eleventh hour on Monday.
Mrs Foster said that "substantial changes" to the text rejected on Monday would mean there was "no red line down the Irish Sea" in the form of a customs barrier between Northern Ireland and the rest of the UK.
Mr Juncker said that the decision on whether to move forward to talks on trade and the transition to a post-Brexit relationship was in the hands of the leaders of the 27 other EU nations, meeting in Brussels at a European Council summit on Thursday, but said he was "confident" they would do so.
The Commission president said: "I will always be sad about this development, but now we must start looking to the future, a future in which the UK will remain a close friend and ally."
Mrs May said that intensive talks over the past few days had delivered "a hard-won agreement in all our interests".
The Prime Minister said that the agreement would guarantee the rights of three million EU citizens in the UK "enshrined in UK law and enforced by British courts".
She said that it included a financial settlement which was "fair to the British taxpayer" and a guarantee that there will be "no hard border" between Northern Ireland and the Republic, preserving the "constitutional and economic integrity of the United Kingdom".
She said that the agreement between the UK and the Commission, being published in a joint report, would offer "welcome certainty" to businesses.
Under the terms of the negotiations being carried out under Article 50 of the EU treaties, the European Council must agree that sufficient progress has been made on the divorce issues of citizens' rights, the Irish border and the UK's financial settlement before talks can move on to the issues of trade and transition.
The publication of the joint report makes it all but certain that EU27 leaders will approve this step on Thursday, marking a significant step forward in the process leading towards UK withdrawal in March 2019.
It eases pressure on Mrs May, who was facing the prospect of businesses activating contingency plans to move staff and activities out of the UK if no progress had been made by the end of the year.
Mr Juncker cautioned: "The joint report is not the withdrawal agreement. That agreement needs to be drafted by the negotiators on the basis we have agreed yesterday and today and then approved by the Council and ratified by the UK Parliament and European Parliament."
He said that he and Mrs May had discussed the need for a transition period following the formal date of Brexit, and shared "a joint vision of a deep and close partnership".
"It is crucial for us all that we continue working closely together on issues such as trade, research, security and others," he said.
"We will take things one step at a time, starting with next week's European Council, but today I am hopeful that we are all moving towards the second phase of these challenging negotiations and we can do this jointly on the basis of renewed trust, determination and with the perspective of a renewed friendship."
Mrs May said that the negotiation process "hasn't been easy for either side".
"When we met on Monday, we said a deal was within reach," said the PM. "What we have arrived at today represents a significant improvement."
Mrs May said: "I very much welcome the prospect of moving ahead to the next phase, to talk about trade and security and to discuss the positive and ambitious future relationship that is in all of our interests."
She added: "The deal we've struck will guarantee the rights of more than three million EU citizens living in the UK and of a million UK citizens living in the EU.
"EU citizens living in the UK will have their rights enshrined in UK law and enforced by British courts. They will be able to go on living their lives as before."
On the issue of the UK's so-called "divorce bill", which is expected to total up to £50 billion, Mrs May said that in her landmark speech in Florence in September she had made clear the UK was "a country that honours our obligations".
She said: "After some tough conversations, we've now agreed a settlement that is fair to the British taxpayer. It means that in future we will be able to invest more in our priorities at home, such as housing, schools and the NHS."
And on the Irish issue, she said the UK would "guarantee there is no hard border and uphold the Belfast Agreement, and in doing so, we will continue to preserve the constitutional and economic integrity of the United Kingdom".