The Mehr news agency reported that the websites, including that of the National Iranian Oil Company (NIOC), were targeted from Sunday.
An oil ministry spokesman, Alireza Nikzad, told the Fars news agency the attack was a “virus” which “attempted to delete data on oil ministry servers.”
The ISNA news agency, identifying the virus as “Viper”, said the attack had deleted data off the servers. The ministry spokesman, however, said “essential data” was unharmed.
“The cyber attack has not harmed essential data of the oil ministry and the NIOC because the main servers are not connected to public servers,” Nikzad said, adding that data was available on off-line servers.
He did not give further details.
The Internet websites of the oil ministry (www.mop.ir) and the NIOC (www.nioc.ir) appeared to be inaccessible on Monday.
Iran in 2010 was the target of a massive cyber attack by a highly sophisticated worm called Stuxnet that penetrated at least 30,000 computers across the country and seemed to specifically target machines linked to centrifuges carrying out uranium enrichment.
Many international experts believe the virus was developed by the United States, possibly with Israeli collaboration, to disrupt Iran’s disputed nuclear programme.