MADRID (Reuters) - Spanish companies including Telefonica were hit by a so-called ransomware hack into their computer systems on Friday, with Spain's cyber security body warning of a "massive attack" affecting several firms.

Ransomware attacks meddle with computer systems by scrambling or hi-jacking them while asking for a ransom to return them to normal.

NEWS OF THE DAY: President Trump's Very Bad Week ]

"There has been an alert relating to a massive ransomware attack on various organizations, which is affecting their Windows systems," Spain's National Cryptology Centre said in a statement, adding that a large number of firms had been hit.

It did not name them.

A spokesman for Spanish telecoms giant Telefonica said there had been a problem with the company's IT systems but said that this had affected only the internal network and had not hit clients or the firm's service to customers.

"News (of this attack) has been exaggerated and our colleagues are working on it right now," Chema Alonso, Telefonica's chief data officer and a well-known cyber security expert, said in a message on Twitter.

Vodafone's unit in Spain, power company Iberdrola and utility Gas Natural have asked staff to turn off computers as a preventive measure, spokespeople at the respective firms said.

"For now we've not been affected but we're looking at precautionary measures such as cutting off internet access for employees," a spokesman at Vodafone said.

(Reporting by Carlos Ruano and Jose Rodriguez, Writing by Sarah White; Editing by Julien Toyer and Elaine Hardcastle)

Copyright 2017 Thomson Reuters.