Acting assistant attorney general Mary McCord announced that the four people had been indicted at a news conference in Washington DC.
She said: "Two FSB officers, protected, directed, facilitated and paid criminal hackers to collect information through computer intrusions in the US and elsewhere."
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.
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."
"We are deeply grateful to the FBI for investigating these crimes and the DOJ for bringing charges against those responsible."