German Justice Minister Heiko Maas said the measures would ensure German law was applied online.
Social media cannot "become a funfair for the far right," he said.
The agreement follows reports of a rise in online racism in Germany as the country manages an influx of up to one million migrants and refugees in 2015.
Mr Maas said complaints about hate speech would be assessed by "specialist teams" at the three companies, who would also make it easier for such posts to be reported.
They would assess complaints using the benchmark of German law "and no longer just the terms of use of each network", he said.
"When the limits of free speech are trespassed, when it is about criminal expressions, sedition, incitement to carry out criminal offences that threaten people, such content has to be deleted from the net," Mr Maas said.
"And we agree that as a rule this should be possible within 24 hours."
Germany's official welcome for hundreds of thousands of refugees - mainly from Syria, Iraq and Afghanistan - has triggered a backlash from nationalists, including neo-Nazis.
Mr Maas and other critics have previously accused Facebook of acting immediately to remove nudity from users' pages, while allowing racist and xenophobic comments to remain online.
Facebook has said it relies on its users to report offensive comments that incite hatred.
Facebook, Google and Twitter have agreed a deal with Germany under which they will remove hate speech posted on their websites within 24 hours.