At least 16 hospitals are having to reject patients after their systems were taken offline.
A huge cyber attack has infected NHS trusts across the country and has led to all digital systems being pulled down.
The ransomware threatens hospitals that they will lose access to patient records and other files if they don't pay money to the hackers.
NHS Digital, which oversees hospital cybersecurity, says the attack used the Wanna Decryptor variant of malware, which holds affected computers hostage while the attackers demand a ransom.
Pictures posted on social media showed screens of NHS computers with images demanding payment of $300 worth of the online currency Bitcoin, saying: "Ooops, your files have been encrypted!"
NHS Digital said the attack "was not specifically targeted at the NHS and is affecting organisations from across a range of sectors."
Spain, meanwhile, said several Spanish companies had been targeted in ransomware cyberattack that affected the Windows operating system of employees' computers. It did not say which companies were targeted but telecommunications company Telefonica said it had detected a cybersecurity incident that had affected computers of some employees.
In the U.K., hospitals in London, northwest England and other parts of the country reported problems and asked patients not to come to the hospitals unless it was an emergency. There were no reported problems in Scotland or Wales.
NHS Merseyside, which operates several hospitals in northwest England, tweeted that "following a suspected national cyberattack, we are taking all precautionary measures possible to protect our local NHS systems and services."
East and North Hertfordshire NHS Trust, which runs hospitals in an area north of London, said "the trust has experienced a major IT problem, believed to be caused by a cyberattack."
It said its hospitals had shut down all computer systems as a protective measure and cancelled all non-urgent activity.
Bart's Health, which runs several London hospitals, said it had activated its major incident plan, cancelling routine appointments and diverting ambulances to neighboring hospitals.
Britain's National Health Service is a source of pride for many Britons but faces substantial budget issues and has had previous problems with its huge IT system.
Additional reporting by Associated Press
Join our commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies