The law requires foreign social media sites like Facebook and Twitter to appoint representatives in Turkey that will deal with complaints over content.
Failure to designate a representative will be penalised by large fines, the blocking of advertisements or bandwidth reduction by up to 90 percent, essentially restricting access to the sites.
Penalties will also be handed down if content that has been deemed "unacceptable" is not removed or blocked within 24 hours.
The new legislation also requires users' social media network data to be stored in Turkey.
President Recep Tayyip Erdogan called for regulations to control social media earlier this month due to an apparent increase of “immoral acts” on the platforms in recent years.
“These platforms do not suit this nation. We want to shut down, control (them) by bringing (a bill) to parliament as soon as possible,” he said on July 1.
The bill was backed by Erdogan's ruling Justice and Development (AKP) party along with its partner, the Nationalist Movement Party (MHP).
Turkish authorities criticised Twitter in June for suspending more than 7,000 pro-Erdogan accounts, alleging that the company was smearing the government and trying to influence Turkish politics.
International rights group Human Rights Watch said on Monday that the law "signals a new dark era of online censorship," as it enables the government to "control social media, to get content removed at will, and to arbitrarily target individual users."