The Illegal Migration Bill had been stuck in a battle between parliament's House of Commons and the House of Lords, Britain's unelected upper chamber, which had repeatedly made changes to the legislation to water it down.
In the early hours of Tuesday, the last of those proposed changes was voted down. It can now go for Royal Assent, where it is formally approved by the king and becomes law.
The plan to deport asylum seekers has been criticized by some opposition politicians, lawyers, and civil rights groups as inhumane, cruel and ineffective.
United Nations human rights chief Volker Turk said on Tuesday the bill's passage raises "very serious legal concerns" and sets "a worrying precedent for dismantling asylum-related obligations" that other countries may follow.
However, deportation flights to Rwanda are unlikely to start until next year at the earliest and will still hinge on a ruling by the Supreme Court on their legality later this year.
The new legislation is at the heart of the government's pledge to stop asylum seekers from making the dangerous crossing from France to the southern coast of England on small, often unseaworthy boats.
It will prevent most people from claiming asylum in Britain without permission and will deport them either to their country of origin or a so-called safe country like Rwanda.
Among the amendments proposed and finally defeated in the Lords was a demand for shorter time limits on the detention of unaccompanied children, greater protections for victims of modern slavery, and six-month delays in the deportation of migrants.
Britain struck an initial 140-million-pound ($180 million) deal with the East African country last year but the policy has been tied up in the courts. The first planned Rwanda deportation flight was blocked a year ago in a last-minute ruling by the European Court of Human Rights.
The passage of the bill coincided with the arrival of a barge to house migrants off the southern coast of England. The government has defended the use of barges, insisting it is a cheaper alternative to hotels.
Last year, a record 45,755 people came to Britain in small boats across the English Channel, mainly from France. More than 12,000 have arrived this year, a rate similar to 2022.