Acting assistant attorney general Mary McCord announced that the four people had been indicted at a news conference in Washington DC.
The FSB agents were identified as Dmitry Dokuchaev, 33, and Igor Sushchin, 43.
Dokuchaev was an officer in the FSB's Centre for Information Security, which is supposed to investigate hacking crimes and is the FBI's point of contact in Moscow.
According to AFP, he was arrested earlier this year in Moscow on treason charges.
He is accused of running the Yahoo hack, along with his superior Sushchin.
Ms McCord said they had "protected, directed, facilitated and paid criminal hackers to collect information through computer intrusions in the United States and elsewhere".
They are accused of hiring Alexsey Belan and Karim Baratov to carry out the attacks.
Belan, 29, was born in Latvia but has Russian citizenship, a Russian passport and speaks Russian.
The FBI said he may travel within Russia, Greece, Latvia, the Maldives, Thailand and has been on the FBI's most wanted list for three years.
Baratov is a Canadian national and was arrested this week in Canada.
There were no further details given about him.
:: Yahoo cyberattack trial would shine light on Russian hacking
Ms McCord said the targets of the hack included security, diplomatic, journalists and military personnel and the cyberattack was used for espionage and financial gain.
Officials revealed the Yahoo hack began as early as 2014 and, even though the hackers lost access last September, they continued to use the information acquired until as late as December 2016.
Details of 500 million users were stolen during the hack - one of the largest in history .
Yahoo's chief executive Marissa Mayer tweeted: "Very grateful to the FBI and DOJ for bringing to justice the Russian officials and hackers who led the attack on Yahoo."
Earlier, Chris Madsen, the tech company's senior legal director, said: "The indictment unequivocally shows the attacks on Yahoo were state-sponsored.
"We are deeply grateful to the FBI for investigating these crimes and the DOJ for bringing charges against those responsible."
Sky News Technology Correspondent Tom Cheshire said the indictments would be "a massive relief" for Yahoo, which had been criticised for poor security.
Cheshire said that the Russians would not be extradited to face trial in the USA but Baratov's arrest in Canada would likely see him brought over the border "so we'll hear in forensic detail how they hacked".
Britain's spy agency MI5 had also been described as having been "very helpful in the investigation", he added.
The US is not alleging any connection between the Yahoo hacking and the attack on the Democratic National Convention.
Russia has not commented but the country's news agencies cited a "highly placed" source in Moscow as saying that they have not heard from Washington about the charges.
The source also said that the topic was part of an internal political struggle in the US.