The final draft of the law includes prison terms of up to 12 years for crimes of physical sexual abuse, 15 years for sexual exploitation and nine years for forced marriage.
Indonesia's parliament has passed a bill to tackle sexual violence, aimed at providing a legal framework for victims to secure justice in a country where sexual abuse has often been regarded as a private matter.
A majority of lawmakers backed the bill at the plenary session in parliament on Tuesday, overcoming opposition from some conservative groups after six years of deliberation.
"We hope that the implementation of this law will resolve sexual violence cases," speaker of the house Puan Maharani said.
However, some have objected to its limited scope, with only some sex crimes included and the omission of a specific clause on rape which the government has said will be included in other legislation.
"This is surely a step forward," Asfinawati, a law expert at Jentera school of law who has assisted sexual violence victims, said.
Asfinawati noted that definitions of rape currently covered under the criminal code should still be made clearer.
Sexual violence complaints have been rising in Indonesia, where prosecuting sex crimes has been complicated by the absence of a dedicated legal framework, activists say.
Also, victims' concerns of being shamed during questioning have deterred many from speaking up, according to activists.
The final draft of the law includes prison terms of up to 12 years for crimes of physical sexual abuse, both in marriage and outside and 15 years for sexual exploitation.
It also included nine years for forced marriage, which include child marriage, and four years for circulating non-consensual sexual content.
It stipulated that a court must compel convicted abusers to pay restitution and authorities to provide counselling to victims.
Under earlier proposals, the legislation would have also covered abortion and provided a clearer definition of what constituted rape.
The National Commission on Violence Against Women (Komnas Perempuan) and civil society groups first proposed the idea of legislation a decade ago and a bill was submitted to the house four years later.
In January, President Joko Widodo told his government to expedite new legislation, which seeks to make it easier to build cases and secure convictions.