"I have just signed the document, and the text will be published immediately", writes Zelenskyj on Telegram.
Earlier in the day, the law was adopted by the parliament after a closely watched vote.
"I want to thank all members of parliament for adopting the bill", writes the Ukrainian president.
It was last week that the parliament approved an amendment to the law which meant that Ukraine's national anti-corruption bureau (Nabu) and the specialized anti-corruption prosecutor's office (Sapo) would come under the direct leadership of the prosecutor general, who is appointed by the president.
The decision, which raised concerns that the government would interfere in corruption cases, was met with large popular protests and strong criticism from, among other things, the EU.
The bill that has now been adopted by the parliament had been approved by the anti-corruption agencies in advance and means, among other things, that employees of the authorities will have to undergo regular lie detector tests.
Prime Minister Julia Svyrydenko says that the new law "removes the risk of interference in the work of anti-corruption agencies and strengthens the entire law enforcement system."
"This is a clear response to the expectations of society and our European partners", writes Svyrydenko in a statement after the vote in parliament.