The heads of the European Commission and Council - Ursula von der Leyen and Charles Michel - have signed the Withdrawal Agreement, ahead of the UK's exit from the EU on 31 January.
The Queen approved it on Thursday, and next Wednesday the European Parliament is expected to vote for it too.
The UK has agreed to abide by EU rules during a transition period until the end of the year. By 2021 the UK aims to have agreed a deal on future ties.
Brexit ends 46 years in the EU club.
After the document was signed in Brussels it was taken to Downing Street by EU and UK officials, for signing by UK Prime Minister Boris Johnson, due later on Friday. The agreement will then travel back to Brussels, and a copy of it will remain in London.
Next week's European Parliament vote is seen as all but a formality, after it was backed by the parliament's constitutional affairs committee on Thursday.
Mrs von der Leyen and other senior EU figures are sceptical about the UK government's plan to negotiate a comprehensive deal on future relations before the end of 2020. They believe the timetable for that is too tight.
But Prime Minister Boris Johnson is upbeat, insisting the UK can now move forward after years of wrangling over Brexit.
Charles Michel, the former Belgian Prime Minister who chairs EU summits, said in a tweet "things will inevitably change but our friendship will remain.
"We start a new chapter as partners and allies."
.@eucopresident Charles Michel and I have just signed the Agreement on the Withdrawal of the UK from the EU, opening the way for its ratification by the European Parliament. pic.twitter.com/rEqnUnJA2E— Ursula von der Leyen (@vonderleyen) January 24, 2020
The EU Commission official who spent more than three years negotiating Brexit - Michel Barnier - stood behind the two EU leaders at the low-key signing ceremony.
Earlier Mr Johnson said "at times it felt like we would never cross the Brexit finish line, but we've done it.
"Now we can put the rancour and division of the past three years behind us and focus on delivering a bright, exciting future - with better hospitals and schools, safer streets and opportunity spread to every corner of our country."
MPs overruled an attempt by the House of Lords to secure additional rights, including for unaccompanied child refugees, in the Withdrawal Agreement.