German Chancellor Angela Merkel told a news conference that the leaders had agreed on closer cooperation in countering terrorism, after a long discussion at the Hamburg summit.
"We would like to work closer within the framework of the United Nations," she said, adding that their cooperation would focus on countering funding, recruitment and ideological sources of terrorism.
In a joint statement issued after the meeting, the G20 leaders called for "strengthening measures against the financing of international terrorist organisations, in particular ISIL/ISIS/Daesh, Al-Qaeda and their affiliates".
"There should be no 'safe spaces' for terrorist financing anywhere in the world," they added.
The leaders also pledged to improve information sharing between intelligence and law enforcement bodies.
"We will ensure that terrorists are brought to justice," they said.