Peers voted by 309 to 242, majority 67, in support of an amendment to the EU Withdrawal Bill championed by former Conservative Party chairman Lord Patten.
The amendment requires the Government to act in a way compatible with the Good Friday Agreement, and to implement Brexit in a way that does not lead to a hard border between Northern Ireland and the Republic of Ireland.
It is the tenth reverse for the Government on the EU Withdrawal Bill in the upper house, although ministers have signalled their intent to overturn changes to the legislation when it returns to the House of Commons.
The Government have warned amended legislation could hamper Brexit negotiations with the EU.
Responding to the Government’s defeat, Jenny Chapman, Labour’s shadow Brexit minister, said: “This vote sends a clear signal to the Government that they must urgently find a solution to the Northern Ireland border.
“Ill-conceived compromises and unrealistic technological solutions are simply not good enough.
“The Government’s failure to act is holding back the Brexit negotiations and creating deep uncertainty for communities in Northern Ireland.
“Ministers should back this amendment and accept Labour’s call for a new comprehensive customs union with the EU.”
Lord Newby, the Liberal Democrat leader in the House of Lords, said: “This vote has recognised what Theresa May hasn’t, that the issue of the Northern Ireland border is of paramount importance.
“We cannot risk Conservative incompetence and Brexit dogma creating a hard border, and we will not allow years of strong relations within these islands to be jeopardised by Brexit.”
And Lord Hain, a former Northern Ireland secretary and supporter of the People’s Vote campaign for a referendum on the final Brexit campaign, said: “The Government’s half-baked plans on future customs arrangements risk rolling back years of progress on the island of Ireland, and threaten the re-emergence of a hard border.
“No Parliament in its right mind should let that happen. Tonight’s amendment, if also passed in the Commons, would be a step in the right direction.
“But on its own it would not be enough to avoid a hard border – that will ultimately depend on whether the Government change course and negotiate to stay in the single market and customs union.”
Among 19 Tory rebels who helped defeat the Government on the amendment were ex-deputy prime minister Lord Heseltine and former ministers Lord Willetts, Viscount Hailsham and Baroness Altmann.
In the debate preceding the vote, Lord Patten highlighted a previous claim by prominent Brexiteer and former Conservative Scottish secretary Lord Forsyth, who accused Remainer peers of “playing with fire” by attempting to add amendments to the EU Withdrawal Bill.
Lord Patten, a former EU commissioner and BBC Trust chairman, told peers: “I’ll tell you what I think playing with fire is.
“I think playing with fire is blundering into the politics of Northern Ireland with a policy that is sometimes clueless, and sometimes delinquent, with a can of petrol and a box of matches in the other hand.
“I think that’s playing with fire. I think that’s what we’re really in danger of doing.”
The House of Lords will continue their scrutiny of the EU Withdrawal Bill into next week.