The Human Tissue (Authorisation) (Scotland) Bill was passed at the Scottish Parliament on Tuesday by 116 votes to three, with two abstentions.
It means there will be a presumption of consent for organ donation unless a person has indicated that they do not wish to be donors.
Under current law, donors must opt in for their organs to be donated, with many people carrying a donor card.
Similar opt-out legislation was passed by the Welsh Government in 2015.
"There is no one answer to increasing organ and tissue donation," said Public Health Minister Joe Fitzpatrick in moving the Bill.
"That is why we must continue to build on the measures that have been put in place over the last 13 years and to which this Bill contributes."
Mr Fitzpatrick said the legislation will include safeguards for those who do not have the capacity to understand deemed authorisation, as well as for people residing in Scotland for fewer than 12 months who may not be aware of the system.
"The Bill ensures that the interests and the views of the donor are safeguarded at all times by including a clear and effective mechanism to do this," said Mr Fitzpatrick.
"There is a duty on health workers to make inquiries of families and others who are entitled to provide information reflecting the most recent views of the donor."
Scottish Conservative MSP Miles Briggs said the legislation will help to increase donor numbers, as well as taking into account the wishes of donors.
"For the many families and campaigners across Scotland, today is an incredibly important day," said Mr Briggs.
"We need to work to continue to progress and increase donor numbers and save the lives of more people across Scotland and the UK.
"I believe this Bill can and will deliver on those two main aims - to further increase donor numbers, while honouring donors' decisions and the decision they've taken during their life."
Scottish Labour MSP David Stewart said: "I believe this is a vitally important piece of legislation and will be a matter of life and death for many Scots desperately in need of life-saving organ donation."
Scottish Green MSP Alison Johnston said: "The policy memorandum for the Bill today reminds us that organ and tissue donation and transplantation is an incredible development in modern healthcare, which continues to save and significantly improve lives, and the Greens strongly support the intent of this important Bill.
"It also reminds us that organ and tissue donation and transplantation is dependent on the generosity, the commitment and the skill of a number of people and I'd like to thank them all."
Scottish Liberal Democrat MSP Alex Cole-Hamilton described it as an "emotional day" and paid tribute to his late friend Anders Gibson.
He said: "It is an emotional day for me, it's a joyful one at that as well.
"When I was an aspirant political candidate, in hustings we were often asked what your private members Bill would be if you made it to the Scottish Parliament.
"As I said at Stage 1, this would be that Bill and that came from a lifetime of understanding about the needs for organ donation and the paucity of organ donation that has until now existed in this country.
"That is because my good friend Anders Gibson, who suffered from CF (cystic fibrosis), I grew up alongside with an expectation that his life would always be cut short.
"It is to my great sadness that Anders didn't live to see this day, that his lung transplant ultimately came too late and didn't properly take.
"But I speak in his memory today and I know that he is looking down on us with great pleasure at what this parliament is about to do."