The high-profile indictment is one of the biggest in the US against foreign attackers
The US has charged seven Iranians for allegedly hacking nearly 50 financial companies and a New York dam.
The attacks, occurring from 2011 to 2013, are believed to have been co-ordinated from Iranian companies.
The US Department of Justice revealed an indictment against the seven, believed to be working for their government from inside Iran.
The indictment calls them "experienced computer hackers" and officials said the attacks were a "wake-up call".
It is the first time the US is charging people associated with a national government with hacking into US infrastructure for major industries like finance and water.
The attacks "threatened our economic well-being and our ability to compete fairly in the global marketplace - both of which are directly linked to our national security," said US Attorney General Loretta Lynch.
"And we believe that they were conducted with the sole purpose of undermining the targeted companies and damaging the online operation of America's free market."
Mrs Lynch said the attacks cost the victims tens of millions of dollars.
It is unlikely Iran will send the accused to the US
Ahmad Fathi, Hamid Firoozi, Amin Shokohi, Sadegh Ahmadzadegan, Omid Ghaffarinia, Sina Keissar and Nader Seidi are identified in the indictment as the alleged attackers.
Mr Ahmadzadegan and Mr Ghaffarinia claimed responsibility for hacking into Nasa servers and websites.
Mr Firoozi gained access to the computer system for the Bowman Dam in New York, and according to the indictment, he could have "operated and manipulated" a gate on the dam.
"The potential havoc that such a hack of American infrastructure could wreak is scary to think about," said US Attorney Preet Bharara.
The charges carry a maximum sentence of 10 years in prison for conspiracy to commit and aid and abet computer hacking.
It is almost certain that Iran will not send the accused to the US, and they have not been arrested.
The indictment is still important, said FBI director James Comey.
"The world is small, and our memories are long," he said. "We never say never. People often like to travel for vacation or education, and we want them looking over their shoulder."