At a joint press conference with Brexit Secretary David Davis, the EU's chief negotiator Michel Barnier said a decisive step had been taken.
He said: "What we are presenting to you today, here with David, is a legal text.
"A joint legal text which constitutes in my mind a decisive step because we were able this morning to agree, and after all those days and nights of hard work, on a large part of what will make up an international agreement for the ordered withdrawal of the United Kingdom.
"A decisive step remains a step, we are not at the end of the road and there is a lot of work still to be done on important subjects including Ireland and Northern Ireland."
The pound jumped by almost 1% against the dollar to 1.40 US dollars following the news. Sterling was trading up 0.7% against the euro at 1.14 euros.
On the border between Northern Ireland and the Republic, Mr Barnier said the two sides had agreed how the issue would be dealt with during the remaining negotiations.
He said they had agreed that the EU's "back stop position" which would see Northern Ireland effectively remain part of the single market if there was no wider agreement, would form part of the legal text of the withdrawal agreement.
"The backstop will apply unless and until another solution is found," he said.
Mr Barnier said that there had been "complete agreement" on future citizens' rights and the financial settlement as well agreement on a transition period after the UK leaves the EU in March 2019.
"We agreed that British citizens and European citizens of the 27 who arrive during that transition period will receive the same rights and guarantees as those who arrived before the day of Brexit," he said.
Prime Minister Theresa May said: "I think the message people can take from this is that prior to December people questioned whether we would get agreement then. We did. People questioned whether we would get agreement now. We have.
"I think what this shows is that with good will on both sides, working hard, we can get an arrangement for the future which will be in the interests of the UK and in the interests of the European Union and it will be good for all parts of the UK."