"It's only three years until the Tokyo Olympics and Paralympics and so I'd like to ratify the treaty on organised crime as soon as possible so we can firmly co-operate with worldwide society to prevent terrorism", the prime minister said.
The government also said the legislation is needed to ratify a United Nations treaty on global organized crime, though critics said it could empower the authorities on surveillance and endanger civil liberties.
The ruling Liberal Democratic party and its junior coalition pushed the bill through the upper house of Japan's parliament as thousands of people protested outside.
Japan expert Lim Tai Wei of the National University of Singapore's East Asian Institute said the recent terror attack in Manchester has given Tokyo the impetus to pass a law that can ensure the Olympics - seen as its "coming-out party" after the 2011 quake and tsunami - can be "executed with minimal problems and challenges".
Japan's more powerful lower house passed the bill last month.
Critics are also saying that the gathering of information on possible plots would require expanded police surveillance, and the legislation has been compared to Japan's "thought police", who before and during the second world war had broad powers to investigate political groups perceived as a threat to the public order.
Eternal Badass Alysia Montano Runs 800 Meters Five Months Pregnant
She captured the silver as part of Team USA's women's 4×800-meter relay and gold in the women's 4×400-meter event. Have you read Trendiee Today? This is the athlete's second baby and also her second time running while pregnant.
Terrorism "won't disappear because of this law", said 29-year-old demonstrator Yohei Sakano outside parliament.
"Three years ahead of the Tokyo Olympic and Paralympic Games, we hope to cooperate with the worldwide community to prevent terror", he added.
Opposition Democratic Party leader Renho, who goes by only one name, made a statement that deemed the legislation "brutal" and a violation of free thought. Chief Cabinet Secretary Yoshihide Suga said the letter was "inappropriate" and denied that the law would lead to excessive surveillance. A survey carried out by Kyodo news in May noted support for the legislation at 39.9 percent versus 41.4 percent against it. More than 77 per cent said further explanation was needed.
This is Tokyo's fourth attempt to pass the contentious law, which punishes 277 crimes. He added that he had identified "significant worrying signals" in Japan's record on freedom of expression, the Guardian reported.
Demonstrations were also held elsewhere in Japan including in Fukushima Prefecture in northeastern Japan and Kagoshima Prefecture in southwestern Japan, where rallies drew about 500 protesters each. Others are concerned that he may take his eye off the ball when it comes to reviving the economy or dealing with Japan's sliding population.
"The party has to have a debate on what to prioritise, be it social policy, economic policy or the constitution".
- Ronaldo header gives Portugal 1-0 win over hosts Russian Federation
- Colorado officer escorting Pence motorcade hurt in crash
- Devils select Swiss center Nico Hischier with No. 1 pick
- Toll from Pakistan tanker fire climbs to 148
- Federer beats Alexander Zverev 6-1, 6-3 for 9th Halle title
- 'Transformers: The Last Knight' debuts to a franchise low
- Arab states don't seek 'regime change' in Qatar
- Cable auto snaps in Gulmarg, 5 die, 4 from one Delhi family
- Amateur radio operators gather for preparedness drill
- Mourinho wants this player instead of Ronaldo