The violence flared just days after parliament approved controversial legislation banning the distribution of so-called "gay propaganda" to minors, which critics warn will be used to justify homophobic actions and arbitrary prosecution of gays.
"Homophobia is Saint Petersburg's shame" and "Down with fascism" chanted about 100 gay rights campaigners, while a group of about 150 rival demonstrators hurled bottles, stones and jam jars at them.
Police said dozens of activists from both sides were arrested.
Gay activists have blasted the bill, which won final approval from the upper house of parliament on Wednesday, as discriminatory.