The Russian Foreign Ministry said that an unknown militant set off an explosive device near the entrance to the consular section of the embassy around at 10:50 a.m. Kabul time.
"Two our colleagues died... We will hope that the perpetrators of this terror attack and its executors will receive just punishment very soon", Russian foreign minister Sergei Lavrov told reporters in Moscow.
Police said the attacker was shot dead by armed guards as he approached the gate, in one of the first such attacks since the Taliban took power last year.
The four others killed were Afghan civilians, Khalid Zadran, a Kabul police spokesman said.
Russia is one of the few countries to have maintained an embassy in Kabul after the Taliban took over the country more than a year ago. Although Moscow does not officially recognise the Taliban's government, they have been in talks with officials over an agreement to supply gasoline and other commodities.
The United Nations' mission in Afghanistan (UNAMA) condemned the blast.
During the decades-long Taliban insurgency against the western-backed Afghan government, bombings targeting foreign missions were a regular occurrence in Kabul, especially in recent years, with embassies and hotels fortifying themselves with razor wire and blast walls.
Such incidents have decreased dramatically since the insurgent group swept to power in August 2021.
Since then, attacks - some of them claimed by Islamic State - mainly targeted the Taliban and civilian targets such as mosques.