Angela Merkel’s cabinet voted on the measures amid concerns over free speech, with campaigners, technology firms and journalists raising fears that tightened regulations could restrict expression.
Heiko Maas, the German justice minister, vowed to push for similar rules Europe-wide, adding: “There should be just as little tolerance for criminal incitement on social networks as on the street.
“We owe it to the victims of hate crime to manage this better.”
The bill strengthens Germany’s existing laws covering hate speech, slander, defamation, threats and incitement, adding to prison sentences already enforceable for Holocaust denial or inciting hatred against minorities.
The issue has taken on increasing urgency ahead of the country’s federal elections in September, with concerns the proliferation of “fake news” and racist content online could affect the outcome.
Fears over terror attacks claimed by Isis have been a point of contention, as has the reaction to the arrival of more than 1 million refugees in Germany over the past two years.
Facebook won a court case last month after a Syrian refugee falsely accused of being a terrorist and attempted murderer in a series of xenophobic posts attempted to sue the social networking giant for damages.
Anas Modamani, whose chance selfie with Ms Merkel is one of a series of images seized upon by far-right groups, argued that failure to remove the posts put him at risk.
His lawyer pointed out that Facebook’s community standards violations did not include libel, which is a criminal offence in Germany, the UK and elsewhere.
The new law would give social networks 24 hours to delete or block criminal content and seven days to deal with less clear-cut cases, with an obligation to report back to the person who filed the complaint about how it was handled.
Failure to comply could see a company fined up to €50m (£43m), with its chief representative in Germany handed an additional penalty of €5m (£4.3m).
The Digital Society Association was among the groups opposing the move, with its head Volker Tripp saying: “It is the wrong approach to make social networks into a content police.”
Bitkom, an association that represents digital companies, said the government should build up specialist teams to monitor online content for potential infringements, rather than expect social networks to do it themselves.
“Given the short deadlines and the severe penalties, providers will be forced to delete doubtful statements as a precaution,’ said Bitkom manager Bernhard Rohleder.
“That would have a serious impact on free speech on the internet.”
Since it was unveiled last month, the draft law has been amended to include new categories of content, such as child pornography and now allows courts to order social networks to reveal the identity of the user behind criminal posts.
To address concerns over free speech, the legislation was tweaked to make clear that a fine would not necessarily be imposed after just one infraction, and still needs to be approved by the Bundestag.
Mr Maas said freedom of expression was “of huge importance” in Germany, but that “freedom of expression ends where criminal law begins”.
The justice ministry said research showed that Facebook deleted just 39 per cent of content reported by users and Twitter only 1 per cent, despite signing a code of conduct in 2015 that included a pledge to delete hate speech within 24 hours.
The cabinet also approved a new law cracking down on the recognition of child marriage among arriving refugees on Wednesday.
It proposes automatically declaring certificates void if one of the partners was under the age of 16 when they wed, despite concerns that the move would leave young female asylum seekers and those with children vulnerable.
In principle, marriages involving under-18s will also not be recognised, but courts will be allowed to decide whether to annul them on a case-by-case basis after receiving advice from youth protection agencies.
Cabinet members agreed the measure as a newspaper report claimed that about 270,000 Syrians living in Germany have the right to bring their family members into the country.
Bild’s report could add fuel to the raging debate about migration less than six months before national elections, where Ms Merkel is seeking a fourth term as Chancellor.
Her conservative bloc faces opposition from the anti-immigration Alternative for Germany (AfD) party, which has lost support in recent months amid improving poll performances by the centre-left Social Democrats.
Join our commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies