Nauru has updated its Crimes Act, decriminalising homosexuality and abolishing suicide as an offence.
The government says parliament passed the Act two weeks ago to replace the Criminal Code of 1899 and to comply with international treaties and obligations.
The death penalty has been abolished.
The new law increases penalties for sexual offences and makes rape within marriage a crime.
It provides for new crimes such as stalking, voyeurism and posting pornography.
The Act prohibits slavery and torture to stop a child from being coerced to marry another person in exchange for a material benefit.
Parliament passed other acts, allowing for the establishment of an Office of the Public Legal Defender.