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.
The document is now on its way to Downing Street for signing by UK Prime Minister Boris Johnson.
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”
The EU Commission official who spent more than three years negotiating Brexit – Michel Barnier – stood behind the two EU leaders at the 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.