The law enacted on Thursday mandates central and local governments to come up with policies to prevent suicides and support bereaved families.
It was unanimously approved by the lower house and endorsed by the upper chamber.
It requires the government to report annually on its progress, and asks employers to work with the authorities to take better care of workers' mental health.
A total of 32,552 Japanese killed themselves in 2005, the eighth straight year the figure was above 30,000 and 4.7 times as high as the number of those killed in traffic accidents, police figures show.
Japan is one of the three most suicidal nations in the world, along with Russia and Hungary.
Yasuyuki Shimizu, a representative of non-profit organisation Life Link, which fights suicide, said the law "will finally create the foundation for civil groups, governments and academics to join hands" to fight the problem.
"Conducting a survey to find out what drives people to kill themselves is the first thing that needs to be done, but we also should not wait to implement actual preventive measures," he said.
Some experts blame the higher suicide rate on the widening of the gap between rich and poor and loosening of the social safety net as Japan recovers from a decade of economic stagnation.
Others point to the lack of religious taboos in Japanese culture against suicide.
About 72% of Japanese who committed suicide last year were men and nearly half of all those who killed themselves were jobless, according to the National Police Agency.
The bill was proposed by a non-partisan group of legislators and sets up a group under the chief cabinet secretary to work on suicide prevention.