The government has lost three votes in the Lords over its Brexit legislation – its first defeats since the election.
Peers supported calls for EU nationals to be given a physical document as proof they have the right to live in the UK after it leaves the bloc.
They also voted to remove ministers’ power to decide which EU Court of Justice rulings can be disregarded or set aside by UK courts and tribunals.
Ministers will aim to reverse the moves when the bill returns to the Commons.
With a majority of 80, the government will be confident of getting its way.
The EU Withdrawal Bill, which paves the way for the UK to leave the EU with a deal on 31 January, was approved by MPs earlier this month without any changes.
But despite their emphatic victory in December’s general election, the Conservatives do not have a majority in the Lords and have suffered a series of defeats during the bill’s passage through the unelected House.
The first amendment passed by peers, by a margin of 270 to 229, would give EU citizens in the UK the automatic right to stay, rather than having to apply to the Home Office, and would ensure they can get physical proof of their rights.
Its supporters said it would allay the “deep concerns” felt by many EU nationals who have until the end of June 2021 to apply for settled status.
More than than 2.7 million people have so far applied. Nearly 2.5 million of these have been told they can continue to live and work in the UK after Brexit, while six “serious or persistent” criminals have had their applications rejected.
Campaigners said official documentation could stop a repeat of the Windrush scandal, in which relatives of those who lawfully came to the UK from the Caribbean in the 1940s were threatened with deportation, and in some cases removed.
Lib Dem peer Lord Oates warned of a “plethora of problems” ahead for EU nationals and the government unless this happened.
“This amendment simply seeks to uphold the promise repeatedly made by Boris Johnson that the rights of EU citizens to remain in the UK would be automatically guaranteed,” he said.
“It would remove the risk that those who failed to meet the cut-off deadline would be automatically criminalised and subject to deportation.”
No 10 has insisted EU citizens will not automatically be deported if they fail to sign up to the scheme by the deadline. They want them to use a digital code, which will demonstrate their right to be in the UK.
Following the vote, security minister Brandon Lewis insisted it would not rethink its approach.
He tweeted: “The EU Settlement Scheme grants EU citizens with a secure, digital status which can’t be lost, stolen or tampered with.”