The legislation, passed after a heated debate in parliament, was first introduced by lawmakers from Prime Minister Recep Tayyip Erdogan's AKP party in the run-up to last month's local elections.
The party won a resounding victory despite a corruption scandal that emerged last December, which has been fuelled by a steady flow of leaked classified information.
The new law is a direct attempt to stop the leaks, which have implicated key members of Erdogan's inner circle and included an alleged recording of the prime minister ordering his son to hide illicit funds.
It also sets prison terms for journalists and others who publish leaked information, according to local media reports.
Last week, Turkey's constitutional court annulled sections of another controversial law intended to tighten the government's control over the judiciary.
The new legislation is the latest ammunition being deployed by Erdogan as he seeks to push back against the greatest challenge yet to his 11-year rule.
The premier has accused Fethullah Gulen, a US-based Muslim cleric, and his loyalists in the Turkish police and justice system, of being behind the corruption probe and the leaks.
