The Welsh Assembly has joined the Scottish Parliament and the Northern Ireland Assembly in rejecting the Brexit bill.
It means all of the UK’s devolved law-making bodies have voted against the withdrawal agreement legislation.
A total of 35 assembly members, from Labour and Plaid Cymru, opposed the law, while 15 backed it.
First Minister Mark Drakeford said the law unilaterally rewrites the way devolution works in Wales.
His counterpart in Scotland, Nicola Sturgeon, said the three votes were “unprecedented and momentous”.
Brexit Secretary Stephen Barclay had appealed to Welsh ministers not to vote the bill down, saying it respected the result of the 2016 referendum when Wales voted to leave.
The legislation is currently passing through the UK Parliament – the government lost three votes in the House of Lords on the legislation on Tuesday.
Normally the devolved assemblies and parliaments must give their permission before Westminster can legislate on issues that impact them.
Consent has not been given by any of the three bodies, although the moves are not legally binding and will not stop the UK government pressing ahead.
Analysis by BBC Wales political editor Felicity Evans
Although this vote will not stop the Brexit legislation becoming law, it is still significant.
That’s because this is the first time legislatures in Wales, Scotland and Northern Ireland have all refused to consent to UK government legislation that affects devolved matters.
Now it is true that Wales is the only one of those nations where the majority of voters opted to leave the EU in 2016, and many pro-Brexit voices in the chamber called on Plaid and Labour to accept political reality.
But many of the objections to this legislation are around the perceived sidelining of the Senedd, even in areas over which it is supposed to have control.
With concerns about increasing strains on the union of the four home nations, the UK government must be sensitive to accusations that it’s trampling all over other people’s lawns.
That’s probably one of the reasons the Brexit secretary wrote to the Welsh Government reassuring them that the UK Government remains committed to the principle of consent, except in this “singular” case.
AMs on Tuesday debated a legislative consent motion on the bill, which was rejected by a majority of the chamber.
The Labour Welsh Government has not backed Mr Johnson’s deal over fears it will not lead to a close enough relationship with the EU and would prove damaging to Wales’ economic interests.
Welsh First Minister Mark Drakeford told AMs: “Brexit is going to happen. That is a fact.” But he said how Brexit happens is “anything but settled”.
“A mandate for Brexit is not a mandate for bad legislation,” he said, claiming the protocol on Northern Ireland will cause “friction” at Welsh ports.
He told the chamber law would allow the amendment of the Government of Wales Act which governs how the assembly works, accusing the UK government of a “unilateral rewriting of the devolution settlement”.
He said he was “not under any illusion” that refusal will stop the bill from being enacted.
The Brexit Party and the Conservatives supported giving the assembly’s consent.
Welsh Conservative assembly group leader Paul Davies said the consent vote was a “clear opportunity to deliver the result of the referendum”.
“We on this side of the chamber believe it’s time to get on with the job,” he said.
“We should be more optimistic and not adopt the Welsh Government’s sometimes dour approach of doom and gloom.”
Members of the Northern Ireland Assembly voted against giving their consent for the legislation on Monday.
Its two largest parties, the Democratic Unionist Party and Sinn Fein, oppose the prime minister’s Brexit deal for different reasons. The Scottish Parliament voted that it would not given consent earlier in January.
Nicola Sturgeon said for the UK government to ignore the votes “will simply demonstrate how broken the Westminster system is”.
Steve Barclay, prior to the vote, had called on the Welsh Government to change its mind.
“I hope that you will revise your recommendation and support this bill,” he told Brexit minister Jeremy Miles in a letter published on Monday.
“It allows us to respect the result of the referendum, in which the people of Wales voted to leave the EU, to move on to focus on other priorities and at the same time bring the country together.”
Plaid Cymru AM Delyth Jewell said her party could not support the bill because “it threatens Welsh powers, removes parliamentary oversight of the negotiations, takes away the rights of child refugees, workers and EU citizens and unnecessarily rules out an extension to the negotiating process, making a bad deal or even no deal at all the most likely outcome”.
Brexit Party’s Mark Reckless accused Welsh Labour of a “futile anti-Brexit stunt”.
“They have learned nothing from the Brexit Party’s victory in the European elections, nor the Conservative victory in December,” he said.