The lower house of the Japanese parliament has approved a state secrecy bill that imposes stiffer penalties on civil servants who leak secrets and journalists who try to obtain them.
The move had been criticised by reporters and freedom of speech campaigners as a heavy-handed effort to suppress press freedom.
But the government says the move is needed for national security reasons.
The bill now goes to the upper house, where it is also likely to be passed.
Critics say the new law could allow the government to withhold more information and ultimately undermine Japan's democracy.
The bill was approved by the lower house - the more powerful of the two chambers in the Japanese parliament - after it was delayed following hours of protests by opposition lawmakers.
The bill's supporters in the government confidently expect it to be approved by the upper house next month.
Prime Minister Shinzo Abe's Liberal Democratic Party says the law is needed to encourage the US and other allies to share national security information with Japan.
Correspondents say that it is part of Mr Abe's efforts to strengthen his country's role in global security.
"This law is designed to protect the safety of the people," Mr Abe said, promising that people's concerns about the bill would be addressed through further parliamentary debate.
The bill allows heads of ministries and agencies indefinitely to make secret 23 types of information related to defence, diplomacy, counter-intelligence and counter-terrorism.
Under the law, public servants or others cleared for access to state secrets could be jailed for up to 10 years for leaking information.
Journalists and others in the private sector convicted of encouraging such leaks could get up to five years in jail if they use "grossly inappropriate" means to solicit the information.
Opponents of the legislation say the new rules fail to address basic concerns on civil liberties and the public's right to know.
They say that the regulations will adversely affect freedom of information and block critical reporting of the government.
Campaigners have also warned that reporting on a wide range of sensitive issues will be affected by the changes, which will also have a dampening impact on whistleblowers.
The Japanese move has been welcomed by the US, which wants a stronger Japan to offset China's military rise.
But correspondents say it has also raised fears that Japan could be edging back toward its militaristic past, when free speech was severely restrained.
Some experts say that the new legislation eases the way for Mr Abe's campaign to revise Japan's US-drafted pacifist constitution.