The attempted bombing came five days after a double suicide attack that killed 16 people, including the two bombers, at a rock concert in Moscow, and it appeared to be another attempt by Chechen rebels to bring their war against Russia to the nation's capital.
The woman was detained after her behavior attracted the attention of security guards, officials said.
Her bag, which contained the bomb, was left on the street.
"The security guards were vigilant," Moscow police spokesman Valery Gribakin told NTV television. "Something in her action attracted their attention, and they called the police."
When a Federal Security Service agent approached the bag and tried to defuse the explosive device, it went off, killing him, the Moscow police press service said. The area had previously been cleared of people.
Interior Ministry spokesman Konstantin Tarasov said the detained woman was a resident of Chechnya and was born in 1980.
A spokeswoman for the Moscow Prosecutor's Office, Svetlana Petrenko, said investigators were treating the incident as a case of terrorism and that it could be linked to Saturday's suicide attacks.
Interior Ministry spokesman Yuri Shuvalov said authorities had advance information that suicide attacks were planned for the period between July 11 and July 20, Interfax news agency said.
Glass shards covered a stretch of Moscow's main central avenue, Tverskaya Street, and some metal shop signs were twisted.
The twin bombings Saturday were the biggest terrorist strikes in Moscow since Chechen rebels' seizure of about 800 people in a theater last fall. Security forces stormed the building, but 129 hostages were killed along with the attackers.
The theater raid was seen as an attempt by rebels to attract attention to their separatist struggle, which is now in its fourth year.
By Sarah Karush