Despite being hauled back from a break up early in the final set, the world number seven served out solidly to take the title and better her silver from Sydney in 2000.
"I never expected a medal - gold, silver or bronze," said Dementieva, 26, a runner-up at the French and US Opens in 2004.
"It's unbelievable. For me this is the best moment in my career. I'll never forget it. I've been dreaming about this moment since I was eight years old."
Safina - who had won all three of the pair's previous meetings this year - hugged the champion after she fell to her knees in celebration.
Zvonareva, a late call-up for the injured Maria Sharapova, clinched the bronze medal play-off against Li 6-0 7-5.
(L-R) Dinara Safina, Elena Dementieva and Vera Zvonareva with their medals
"Having three Russian girls left standing in the Olympics is a huge moment for Russia," Dementieva said.
"I know we were expecting and planning for some medals but I don't think anyone could expect three medals from the girls."
In the women's doubles, 2000 champions Serena and Venus Williams won their second career gold with a one-sided 6-2 6-0 victory over Spain's Anabel Medina Garrigues and Virginia Ruano Pascual.
Bookmark with:
What are these?