The Internal Market Bill, which will give the UK the power to disregard part of the Brexit withdrawal treaty dealing with trade to and from Northern Ireland, cleared the House of Commons late on Tuesday.
The bill was approved by 340 votes to 256, a government majority of 84.
European Union leaders fear the bill could lead to the re-imposition of a hard land border between Northern Ireland and the Republic of Ireland and erode the stability that has underpinned peace since Northern Ireland's 1998 Good Friday accord.
The UK government says it respects the peace accord and the Brexit withdrawal agreement but wants the law as a “safety net” in case the EU makes unreasonable demands after Brexit that could impede trade between Northern Ireland and the rest of the UK.
EU and British negotiators hunkered down Tuesday to seek last-minute compromises on everything from fisheries to competition in hopes of creating a post-Brexit trade deal. But the atmosphere was soured by UK lawmakers' vote.
The EU has threatened legal action if Britain does not drop the bill.
Time is short for the UK and the EU to mend fences — a transition period that followed Britain’s departure from the EU on January 31 ends in less than 100 days, on December 31.
German Europe Minister Michael Roth, whose country currently holds the EU presidency, said Britain's legislative manoeuvre was “casting a dark shadow over the ongoing negotiations.”
As the bloc's economic engine, Germany has a massive stake in a positive outcome for the Brexit trade talks.
Roth said the withdrawal agreement had been crafted to preserve peace on the island of Ireland, where the UK and the EU have their only land border, between Northern Ireland and the Republic of Ireland.
“To recklessly jeopardize that historic achievement would send a disastrous message," Roth wrote in Der Spiegel.
Five former prime ministers, including Johnson's Conservative predecessor Theresa May, have condemned the legislation.
The business spokesman for the opposition Labour Party, Ed Miliband, said the bill was the work of “legislative hooligans” who were trashing Britain's reputation.
“We are at a grave national moment" amid Brexit and the coronavirus pandemic, Miliband said. "We need new trade deals where our word is our bond, and the government plays these appalling games.”
The legislation still must pass through Parliament's upper chamber, the House of Lords, before becoming law. No date has been scheduled for it to be debated there.
The EU, which demanded Britain drop the bill by the end of the month, will decide by Wednesday night what action to take against the bill, and likely will start a legal fight.