The Civil Contingencies Bill will give ministers the power to do whatever is necessary to restore communications if parts of the internet, critical computer systems or phone networks are disrupted.
The new powers are designed to update the government's disaster recovery plans for dealing with national emergencies that threaten critical parts of the UK's national infrastructure.
Large-scale denial of service and hacking attacks orchestrated by foreign governments or terrorist groups could cause significant disruption, particularly if used alongside a conventional terrorist bomb attack against critical computer installations.
Under the new legislation, emergency services could be given powers to commandeer equipment from the private sector and draw on the resources of computer specialists to deal with any emergency faced by the UK.
Although the intelligence services rate the threat against the UK's electronic infrastructure as "low", the government is anxious to put mechanisms in place to prepare for future threats as more government services go online.
"If somebody had a go at government systems as a whole, somewhere down the line, that could create a national emergency. If someone shut down the benefits system and caused riots, or attacked the financial sector or had a go at the NHS, they would be things that we would worry about," said a government spokesman.
The government plans to conduct joint exercises involving emergency planning officials and private sector computer experts to model the impact of cyberattacks on the UK, although they are unlikely to take place in the immediate future.
The Civil Contingencies Bill defines an emergency as a situation where human welfare, the environment or the political administrative or economic stability of the country is under threat. An attack on computer systems could have an impact on all of these areas, the Home Office said.
The Civil Contingencies Bill, which will replace the 1920 Emergency Powers Act, is likely to be introduced at the end of the year, following a three-month consultation.
Details of the Civil Contingencies Bill at www.cabinetoffice.gov.uk