MEPs have backed the Brexit deal by 621 to 49 votes, paving the way for the UK to leave the European Union on Friday (31 January).
After an emotional debate that lasted more than two hours, MEPs joined hands after the vote for a rendition of Auld Lang Syne by Robert Burns.
The deal will now go to the European Council, which is likely to give its consent on Thursday.
As British MEPs embraced each other and colleagues in the chamber, European Parliament President David Sassoli said that strong ties would remain with the UK.
"We have stood shoulder to shoulder in the European Parliament - fifty years of integration cannot disappear easily," he said.
Opening the debate, Guy Verhofstadt, leader of the Alliance of Liberals and Democrats for Europe from 2009 to 2019, paid tribute to "our British colleagues - or at least the overwhelming majority of them [...]. In the name of all of us," he said. "We will miss you."
"It is sad to see a country leaving that twice liberated us," Verhofstadt said, referring to the role of Britain in the First and Second World Wars, "that twice has given its blood to liberate Europe."
Verhofstadt said that Brexit had highlighted a key question: How it was possible that more than 40 years after a majority of Britons voted to join the EU, the British people had decided to leave.
The new President of the European Commission, Ursula von der Leyen, said that the Withdrawal Agreement was "only a first step".
"I want the European Union and the United Kingdom to remain good friends and good partners."
Von der Leyen took a hard line, however, on the negotiations to come, arguing that the UK would have to commit to upholding EU standards on environment and workers' rights.
In his speech, Nigel Farage, the Brexit Party leader, said that he hoped Britain leaving the EU would be the beginning of the end of the bloc.
"We love Europe, we just hate the European Union. I hope that this begins the end of this project [...]. It gives people power without accountability," he said.
Farage and his Brexit Party MPs then waved their Union Jack flags, in contravention of EU Parliament rules, and gave three cheers to the Brexit Party leader.
The speaker, European Parliament Vice-President Mairead McGuinness, said: "Put your flags away, you're leaving. And take them with you if you're leaving now."
She later confirmed that the Brexit Party MEPs had left the chamber.
The EU parliament's ratification of the deal is the last hurdle in the divorce proceedings and comes just two days before the UK exits the bloc at midnight on January 31.
British lawmakers gave their final backing earlier this month, less than a month after Prime Minister Boris Johnson secured a sweeping parliamentary majority in a snap election.
Royal Assent was granted on 23 January and on Tuesday, Dominic Raab, Britain's foreign minister, signed the Instrument of Ratification — a document which must be signed by officials on both sides.
Debates on Wednesday are expected to focus on the Brexit impact on the island of Ireland and on citizens' rights.
In a resolution passed on January 15, MEPS highlighted that further assurances were needed and expressed concerns "about the application-based approach in the UK EU Settlement scheme, the absence of physical proof for successful applicants, and its accessibility, among other issues."
But less than a week later, British MPs rejected an amendment brought forward by Liberal Democrat peer Jonny Oates to grant EU citizens in the UK the right to stay automatically, thus removing the need to apply.
They also opposed the Home Office having to provide physical proof of status. Currently, EU citizens granted Settlement status are only provided with a digital status.
A recent survey of more than 3,100 European residents in the UK carried out by the3million group and Northumbria University found that 89.5% of them were unhappy about the proof of status being digital only.
The UK's official departure on Friday will usher in a 11-month transition period during which the two sides are to negotiate a trade deal.
EU officials including Commission President Ursula von der Leyen, EU parliament President David Sassoli and Brexit negotiator Michel Barnier have all indicated that the timeframe is too narrow to secure a comprehensive free trade agreement.
Von der Leyen indicated earlier this month that sectors to be prioritised include climate change, fisheries, data protection, energy and security, warning that "trade-offs" will be needed.
Meanwhile, British MEPs are currently packing up their belongings and saying their goodbyes.
"It's been the greatest honour of my life so far to represent Londoners in the European Parliament," Luisa Porritt wrote on Twitter, adding: "My main takeaway is to never give up fighting for a better, kinder world. Nothing is permanent."
Twenty-seven of the 73 seats British MEPs will vacate will be reallocated to other member states.
The three UK flags fluttering in front of the European Parliament, Commission and Council will be lowered at an unspecified time on February 1. One is to be displayed in the House of European history museum.