The upper house of the Japanese parliament passed the anti-terror bill early Thursday after political wrangling through the night, overcoming the weak opposition's no-confidence motion against Prime Minister Shinzo Abe's cabinet and a censure motion aimed at Justice Minister Katsutoshi Kaneda.
The bill passed the more powerful lower house last month. Abe's ruling coalition has a comfortable majority in both houses.
The new law allows investigators to charge an individual or organization that conspires to engage in terrorism or other serious crimes.
But rights groups, Japan's national bar association, and numerous academics have opposed the bill, saying it is so broad it could be abused to allow wiretapping of innocent citizens and threaten privacy and freedom of expression guarantees in the constitution.
US whistleblower Edward Snowden and Joseph Cannataci, the UN special rapporteur on the right to privacy, have both criticized the law.
It has also sparked regular street protests nationwide.
The government argues that the legislation is necessary to prevent terrorism ahead of the 2020 Olympic Games in Tokyo. Officials also say it is a prerequisite for implementing a UN treaty against transnational organized crime that Japan signed in 2000.
The bill was revised several times over the years as earlier versions met with fierce resistance and never made it through the parliament.
The latest bill reduced the number of targeted crimes to some 270 offenses and narrowed the definition of terrorist and criminal organizations.
Earlier versions of the law targeted more than 600 crimes unrelated to terrorism or crime syndicates.
Japan's bar association argued, however, that the current law still gives police and investigators too much leeway in deciding what constitutes a criminal organization.
The general public could be targeted on conspiracy charges via monitoring phone and online conversations, it warned.
Some Japanese media have likened the bill to the World War II-era "public order maintenance law" under which ordinary people were arrested for political offenses, exercising labor rights and anti-war activities.