The indictments, announced at a news conference in Washington, represent the first time the U.S. government has criminally charged Russian officials for cyber offenses.
The Russian agents were identified as Dmitry Dokuchaev and Igor Sushchin, both members of the successor agency to Russia’s KGB.
Dokuchaev and Sushchin paid co-conspirators Alexsey Belan and Karim Baratov to access email accounts, the Justice Department said.
Acting Assistant Attorney General Mary McCord said that Belan is a "notorious" criminal hacker — one of the FBI's most wanted — known for hacking U.S. e-commerce companies.
The content of at least 30 million accounts were accessed as part of a spam campaign and that at least 18 people who used other internet service providers, such as Google, were also victimized, the government charged.
The indictments come amid a high-stakes US investigation into claims of Russian cyber-meddling in the US election, potentially to aid the winning efforts of Donald Trump.
Verizon agreed to buy Yahoo before the breaches were disclosed. In February, Verizon cut $350 million from its purchase price for Yahoo. Earlier this month, Yahoo CEO Marissa Mayer said she would forgo her annual bonus in the wake of the intrusions.
Yahoo's top lawyer, Ronald Bell, resigned this year, after the board of directors concluded that Yahoo's legal team did not sufficiently pursue information about the hacks.