BEIJING (Reuters) - Germany and China have agreed to set up an "early warning system" to avoid problems for German non-governmental organizations from a new Chinese law that restricts such groups, German Chancellor Angela Merkel said on Sunday.

Merkel told reporters that she and Chinese Premier Li Keqiang had agreed to stay in close touch about potential issues once the new law goes into effect on Jan. 1.

The law grants broad powers to Chinese police to question NGO workers, monitor their finances, regulate their work and shut down offices. German rights groups and political foundations have said they fear that the law will hamper their work.

Merkel said Chinese officials had agreed that the work of the NGOs benefited both sides, and it was important to avoid negative consequences from the new law.

"That is why we ... agreed to be in close touch with each other via the foreign ministries or other organizations. I think that is the right way to react initially," Merkel said.

Merkel had said before leaving for Beijing that she planned to raise the issue with Chinese officials. The trip is her ninth to China since she took office in 2005.

(Reporting by Andreas Rinke in Beijing; writing by Andrea Shalal; Editing by Kevin Liffey)