MSPs have passed legislation which will allow ministers to keep Scottish law in line with future EU regulations.
In January, Holyrood will take on responsibility for a range of areas where policy is currently set in Brussels, including environmental and food standards and human rights.
The bill lets the Scottish government choose where to align local standards with those of the EU post-Brexit.
It also sets up a new watchdog to have oversight over environmental standards.
The Scottish government says the EU "will continue to be of fundamental importance to Scotland" after the Brexit transition period is over, and that it should "do everything it can to be an active and constructive participant on EU matters".
The Scottish Conservatives argued that the bill would cause regulatory divergence between Scotland and the rest of the UK, potentially endangering domestic trade and jobs, and would see Holyrood become a "passive rule-taker".
However it passed its final vote at Holyrood 90 votes to 29 with Labour, the Greens and the Liberal Democrats all supporting the SNP administration.
Constitution secretary Michael Russell said: "We have heard the ambition of the people of Scotland to retain the closest links with the EU and to continue to meet the high European standards that presently serve us so well.
"It is completely unacceptable that Scotland has been taken out of the EU, but this Bill makes a start, at least, on meeting those ambitions.
"It will enable us, in devolved areas at least, to maintain alignment with Europe, when appropriate and practicable to do so."
The UK left the EU on 31 January 2020, but is currently still in alignment with many of the bloc's standards and regulations as part of an implementation period, due to end on 31 December.
From that point the Scottish Parliament will take on responsibility for a range of areas which are devolved, but on which policy was previously set EU-wide. These include many environmental standards as well as rules around fishing and farming.
The UK Withdrawal from the EU (Continuity) Bill gives Scottish ministers the power to keep certain devolved laws in line with those of the EU in future, where they deem it "appropriate".
It has a particular focus on environmental rules, copying the core principles underpinning green standards in the EU across into Scottish law, and setting up a new watchdog - Environmental Standards Scotland - to oversee them.
Examples of where ministers could decide to keep pace with EU laws in future include over drinking water quality, livestock and produce standards and labelling, and any changes to environmental standards around new technology or regulations.
MSPs had raised some concerns about so-called "Henry VIII powers" in the bill, which give ministers the power to make changes to the law without consulting parliament.
However the government argued it would be "disproportionate" for all the changes which may be required in future - including many "small and technical" ones - to be put down in primary legislation for MSPs to vote on, and has agreed to make regular reports to parliament on the use of new powers.
The Scottish Conservatives contend that more than a half a million jobs in Scotland depend on barrier-free access to markets cross the rest of the UK.
The party's economy spokesman Dean Lockhart said that keeping pace with some future EU laws would "require firms in Scotland to comply with myriad divergent regulations", which he said would "increase the expense and complexity of doing business".
He also expressed concerns that the bill could represent a "power grab by Scottish ministers", allowing them to bypass Holyrood and "turn it into a passive rule-taker of future EU laws".
Labour meanwhile backed the principle of Holyrood keeping pace with EU laws, particularly on environmental standards.
However they pressed for a greater role for parliament in making decisions about this, saying it should not be "entirely at the discretion of the Scottish government".
The Scottish Greens enthusiastically backed the bill, while calling for the new environment watchdog to be "strong, independent, well resourced and rigorously appointed".
And the Scottish Lib Dems supported the bill and any work "needed to minimise the damaging legacy of Brexit, especially in the area of environmental policy".
A previous "continuity" bill was struck down by the Supreme Court after parts of it were deemed to run beyond the devolved powers of the Scottish Parliament.
However the latest legislation has been judged to be in line with Holyrood's competency by the presiding officer.