The Libyan official said the attackers climbed the walls of the embassy compound from three different directions, firing in the air, and broke down its metal gate. The shooting wounded five, one of whom later died.
An attack last year on a U.S. compound in the eastern city of Benghazi killed the U.S. ambassador and three other Americans.
The official said the attackers also brought down the Russian flag hanging in the balcony of one of the buildings. But the attackers didn't enter the embassy buildings, he said, speaking on condition of anonymity because he was not authorized to talk to the media.
Russia's Foreign Ministry Ministry spokeswoman Maria Zakharova confirmed the attack, saying on Ekho Moskvy radio that according to preliminary information no one among the embassy personnel was wounded.
The attackers were apparently reacting to the killing of a Libyan air force pilot Tuesday. Libyan authorities apprehended a Russian woman, accusing her of killing the pilot, then writing offensive graffiti in his blood. The woman later went on to stab and wound the pilot's mother, authorities say.
Her alleged motives were not clear. In the graffiti scribbled on the walls, she allegedly expressed sentiments against the Libyan uprising that drove longtime leader Moammar Gadhafi from power after an eight-month civil war in 2011.
Libya has been hit by a months-long wave of targeted killings against activists, judges and security agents.
On Wednesday, gunmen in Benghazi shot dead a naval officer and his 7-year-old son before fleeing the scene. Most killings are presumed to be the work of armed factions, often acting out of revenge.
Take ABC13 with you!
Download our free apps for iPhone, iPad, and Android devices