The government's Brexit bill has passed through Parliament after Theresa May saw off a revolt by Tory MPs.
Peers accepted the amendment to the EU (Withdrawal) Bill sent to them from the House of Commons, meaning the bill now goes for Royal Assent, becoming law.
Earlier, the government won the vote 319 to 303, after assurances were accepted by would-be rebels that MPs would have a meaningful say.
The PM called it a "crucial step" in delivering a "smooth" Brexit.
Mrs May said: "Today's votes show people in the UK, and to the EU, that the elected representatives in this country are getting on with the job, and delivering on the will of the British people.
"Over the next few weeks we will publish more details of our proposed future relationship with the EU in a White Paper, and will bring the Trade and Customs Bills back to the House of Commons.
"But today has been an important step in delivering the Brexit people voted for, a Brexit that gives Britain a brighter future, a Britain in control of its money, laws, and borders."
Before the Commons vote, Dominic Grieve, leader of the would-be rebels - who wanted to ensure MPs had the power to stop the UK leaving without a deal - said the "sovereignty of Parliament" had been acknowledged.
Both sides have claimed victory with Stephen Hammond, a pro-EU MP who eventually sided with the government, suggesting ministers had agreed to give Parliament a "real say" on top of other concessions.
But international trade secretary Liam Fox said nothing had really changed and the option of a no-deal Brexit had been left firmly on the table.
"There is no change to the fundamental issue here which is the government cannot be forced by Parliament to negotiate something which it does not want to do," he told the BBC's political editor Laura Kuenssberg.
He said the government had "to be able to hold out in our negotiations the prospect of no deal" otherwise the EU would get the upper hand.
On Wednesday evening, following the Commons vote, Leader of the Lords Baroness Evans of Bowes Park said the EU (Withdrawal) Bill had been "debated at length" and was very different as a result of amendments tabled by the Lords.
"I believe our role now is to accept their view as expressed in a vote a few hours ago," she said.
Peers approved the government's proposal without a vote.
The UK is due to leave the European Union on 29 March 2019 and negotiations have been taking place over the terms of its departure.
By Laura Kuenssberg, BBC political editor
The government was worried enough about losing today to budge, even if they only gave an inch.
It might be a concession that only really parliamentary lawyers understand, but the PM had to move, again, despite not wanting to.
And despite the fact that she did compromise even in a meaningless way (yes I can't believe that I did just write that sentence, but it is relevant), the vote was still relatively close, certainly not comfortable enough for the government to relax any time soon.
What's also the case is that the Tory rebels, or potential rebels more like, weren't willing to take dramatic action in enough number to humiliate the PM.
The vote result suggests that they have the hypothetical numbers, but their critics, and their internal opponents in the Tory party would question if they really have the guts.
How the vote unfolded
The government has been at odds with the House of Lords in the long-running row over what happens if the UK cannot reach a deal with the EU, or if MPs reject whatever deal the government agrees with the EU.
The Commons vote had been expected to be tight and the government eventually prevailed by a majority of 16.
Six Tory MPs - Ken Clarke, Anna Soubry, Sarah Wollaston, Heidi Allen, Antoinette Sandbach and Phillip Lee - rebelled while four Labour MPs backed the government and six other Labour MPs abstained, as did Kelvin Hopkins, who sits as an independent after having the whip withdrawn.
Ms Wollaston tweeted that she was disappointed with the outcome.
I continue to be concerned about the risks of a cliff-edge, no-deal Brexit which I think would have devastating consequences for individuals, businesses & communities. That is why I voted for Parliament to have a meaningful final vote. I am disappointed by today’s result— Sarah Wollaston MP (@sarahwollaston) June 20, 2018
One Labour MP, Naz Shah, voted in a wheelchair after being released from hospital amid Labour claims that normal arrangements sparing unwell MPs from having to enter the chamber had been abandoned.
The truth is the Tories refused to nod her through. This is inhumane treatment. No other workplace would condone this type of working practice. Parliament needs to modernise.— (((Dawn Butler MP))) (@DawnButlerBrent) June 20, 2018
In addition if we had a kinder government.... [insert phrase]https://t.co/Q7WFUYHwma
The sticking points
The debate centred on what happens in three Brexit scenarios:
- If MPs vote down the UK-EU Brexit deal
- If Theresa May announces before 21 January 2019 that no deal has been reached
- If 21 January passes with no deal being struck.
Under these circumstances, the government has said, a minister will make a statement in Parliament, setting out the proposed next steps.
MPs will then vote on this statement. According to the government, this vote should be "on neutral terms", with MPs simply noting what has been said.
But an amendment backed by the House of Lords on Monday went further, saying MPs should have to "approve" the minister's statement.
The Department for Exiting the European Union has now conceded that it will be up to Commons Speaker John Bercow to decide the matter at the time.
Speaking in the Commons, Dominic Grieve said the issue of the meaningful vote was about giving "assurances to the House and many, many people in the country who are worried about this process and how it will end".
If Parliament wished to "speak with one voice" and exert its influence in the face of a non-deal scenario, it "has the power to do it".
Mr Grieve said he had insisted on a key paragraph in the government statement accepting "it is open to MPs to table motions and debate matters of concern and that, as is the convention, parliamentary time will be provided for this".
Another potential rebel Nicky Morgan said she did not wish to see Mrs May "destabilised or undermined" ahead of next week's summit of EU leaders.
But she warned of further battles to come over the UK's trade and customs arrangements with the EU and suggested relationships between MPs had been "strained almost beyond belief".
And Conservative MP Vicky Ford, another pro-European MP who stuck with the government, said the outcome was "not a mandate for a no-deal Brexit".
She said MPs had secured a "backstop" which meant if Parliament rejected the deal it could trigger "another set of negotiations" between the UK and EU aimed at getting an agreement before the UK left.