Among the other nations hit were Spain, Ukraine and India, said researchers from the Kaspersky Lab.
There have been more than 45,000 attacks worldwide, mostly in Russia, the Securelist cyber security website reported.
It said: “It’s important to note that our visibility may be limited and incomplete and the range of targets and victims is likely much, much higher.”
Mikko Hypponen, from tech firm F-Secure, called it “the biggest ransomware outbreak in history”.
Spain’s industry ministry said the attack affected the Microsoft Windows operating system of employees’ computers.
Telecommunications giant Telefonica was among the many targets.
The company claimed the attack was limited to some computers on an internal network and had not affected clients or services.
In the US, delivery company FedEx said it was experiencing issues with some of its Windows systems.
Ransomware is malicious software that infects machines, locks them by encrypting data and then attempts to extort money to let users back in.
The software used in the latest attacks is called WannaCry, or Wanna Decryptor, and exploits a vulnerability in the Windows operating system.
It allows the malware to automatically spread across networks, so it can quickly infect large numbers of machines at the same organisation.
Hacking group Shadow Brokers reportedly released the malmare last month, after claiming to have discovered the flaw from the US National Security Agency.