Western Australia has voted to legalise voluntary assisted dying.

MPs were seen hugging each other while applause erupted in the public gallery as the lower house approved the the last of 55 amendments to the government's bill this week.

WA is the second Australian state after Victoria to legalise voluntary assisted dying, and expects to implement its scheme in 18 months.

Health Minister Roger Cook was applauded by MPs on both sides for his handling of the process, and fought back tears as he welcomed the passing of the legislation.

“We are at the end of a very long process, a momentous process for the West Australian parliament and West Australian public,” he told the chamber.

“It's not a time for jubilation.

“Everyone knows what this legislation is about. It's about reflection. And to reflect that we've chosen compassion and the right to choose.”

The WA parliament spent over 180 hours debating the legislation, mostly in the upper house, where it was heavily amended.

The scheme will allow terminally ill adults in pain and likely to have less than six months to live - or one year if they have a neurodegenerative condition - to take a drug to end their lives if approved by two medical practitioners.

“This is an extraordinary piece of legislation,” Mr Cook said.

“Western Australia is not known for its progressiveness in terms of its legislative reform.

“I'd like to think we've come a respectable second [to Victoria].”

The premier said it is a big moment for the state.

“Today we showed that at least in Western Australia, we can do big things,” Mr McGowan said.

“And in this parliament we have big, compassionate hearts and we're willing to take some political risks to do the right thing.

“For those of you who are worried about your own futures and don't want to die that way ... we thank you for your unwavering support.

“Thank you for your patience. We did it for you.”