The US launched a cyber-attack on Iranian weapons systems on Thursday as President Trump pulled out of air strikes on the country, US reports say.
The cyber-attack disabled computer systems controlling rocket and missile launchers, the Washington Post said.
It was in retaliation for the shooting down of a US drone as well as attacks on oil tankers that the US has blamed Iran for, the New York Times said.
The US has also imposed sanctions President Trump described as "major".
He said the sanctions were needed to prevent Iran from obtaining nuclear weapons and economic pressure would be maintained unless Tehran changed course.
Tensions between the US and Iran have risen since the US last year pulled out of a 2015 nuclear deal between Iran and world powers and reinstated sanctions, triggering economic meltdown in Iran.
Last week Iran said it would exceed internationally agreed limits on its nuclear programme.
Mr Trump has said he does not want war with Iran, but warned it it would face "obliteration" if conflict broke out.
What did the US cyber-attack do?
The attack had been planned for several weeks, the sources told several US media outlets, and was suggested as a way of responding to the mine attacks on tankers in the Gulf of Oman.
It was aimed at weapons systems used by Iran's Islamic Revolutionary Guard Corps (IRGC), which shot down the US drone last Thursday and which the US says also attacked the tankers.
Both the Washington Post and AP news agency said the cyber-attack had disabled the systems. The New York Times said it was intended to take the systems offline for a period of time.
On Saturday the US Department for Homeland Security warned that Iran was stepping up its own cyber-attacks on the US.
Christopher Krebs, the director of the Cybersecurity and Infrastructure Security Agency, said "malicious cyberactivity" was being directed at US industries and government agencies by "Iranian regime actors and their proxies".
They were using "destructive 'wiper' attacks", he said, using tactics such as "spear phishing, password spraying and credential stuffing" in a bid to take control of entire networks.
Iran has also been trying to hack US naval ship systems, the Washington Post reported.
What has Trump said?
He hasn't commented on the cyber-attack reports. On Friday he said he had pulled out of launching conventional strikes on Iran because he had been told that 150 Iranians would be killed.
On Saturday he said he was open to talks with the Iranians.
"If Iran wants to become a prosperous nation... it's OK with me," Mr Trump said. "But they're never going to do it if they think in five or six years they're going to have nuclear weapons."
"Let's make Iran great again," he added, echoing his campaign slogan from the 2016 presidential election.
How have US sanctions hit Iran?
The reinstatement of US sanctions last year - particularly those imposed on the energy, shipping and financial sectors - caused foreign investment to dry up and hit oil exports.
The sanctions bar US companies from trading with Iran, but also with foreign firms or countries that are dealing with Iran.
This has led to shortages of imported goods and products that are made with raw materials from abroad, most notably babies' nappies.
The plunging value of the rial has also affected the cost of locally produced staples such as meat and eggs, which have soared in price.
What happened to the US drone?
Iran's IRGC said the drone's downing was a "clear message" to the US that Iran's borders were "our red line".
But US military officials maintain the drone was in international airspace over the Strait of Hormuz at the time.
Amir Ali Hajizadeh, a high-ranking officer in the IRGC, said another military aircraft, carrying 35 passengers, had been flying close to the drone. "We could have shot down that one too, but we did not," he said.