Cameron said the move, being debated by parliament next week, was vital to protect Britain's security, with 95 per cent of all serious organised crime cases using data from Internet and mobile phone traffic.
"The ability to access information about communications and intercept the communications of dangerous individuals is essential to fight the threat from criminals and terrorists targeting the UK," he said.
A European Court of Justice (ECJ) ruling in April found that an EU data retention directive, implemented in Britain in 2009, was invalid because it interferes with the right to respect for private life.
Downing Street said that following the ECJ ruling, providers could start deleting communications data unless the government adopted fresh legislation.
More From This Section
"Unless we act now, companies will no longer retain the data about who contacted who, where and when," Cameron said, "and we will no longer be able to use this information to bring criminals to justice and keep our country safe."
But critics accused ministers of rushing through intrusive legislation which could infringe privacy rights.
"We are told this is a paedophile and jihadi 'emergency', but the court judgement they seek to ignore was handed down over three months ago and this isn't snooping on suspects but on everyone."
The new law is essentially an extension of current powers, with a sunset clause that would see it expire at the end of 2016, giving the government time to formulate a broader view on future laws surrounding communications data.
"It is the first duty of government to protect our national security and to act quickly when that security is compromised," Cameron said.
"As events in Iraq and Syria demonstrate, now is not the time to be scaling back on our ability to keep our people safe.