Performing in black lingerie with the words "No Fear" scrawled on her bare back, Madonna urged the audience - most wearing pink wrist bands distributed at the door - to "show your love and appreciation to the gay community".
"We want to fight for the right to be free," she said.
The American singer has turned a two-concert tour into a platform for comment on Putin's Russia.
In Moscow on Tuesday, she told a crowd she prays for the release of three members of the band Pussy Riot, who prosecutors want jailed for three years for their "punk prayer" criticizing Putin on the altar of Russia's main cathedral.
She told Reuters Television that the three women, whose trial verdict is to be announced on August 17, had been treated unfairly and suggested they were victims of censorship.
Madonna had promised to use her St Petersburg show to speak out against legislation adopted by the city in March that imposes fines for spreading homosexual "propaganda" that could "damage the health, moral and spiritual development" of minors.
On her Facebook page, she called the law a "ridiculous atrocity".
Critics of the law - the model for a bill submitted to the national parliament - say they fear it could be used to clamp down on the lesbian, gay, bisexual and transgender community, for instance by barring gay rights demonstrations.
St. Petersburg police chief Sergei Umnov told local reporters in July that 74 people had been fined so far.
Homosexuality, punished with jail terms in the Soviet Union, was decriminalized in Russia in 1993, but much of the homosexual community remains largely underground as anti-gay prejudice runs deep.
Numerous attempts to hold gay protests in Moscow, ruled illegal by the authorities, have ended in arrests and clashes with violent Russian Orthodox believers who say homosexuals should be punished or treated for "illness".
"Do we live in fear?" Madonna asked her audience on Thursday night. "No!" came the reply. "We love you!" shouted some fans, but not everybody was thrilled.
"One should not mix showbusiness with human rights activism," said gay rights activist Yuri Gavrikov, who picketed the concert venue. "If she wanted to support the LGBT community, she could have ... refused to hold concerts in Russia."
(Writing by Steve Gutterman, editing by Tim Pearce)
Copyright 2013 mojeNovosti.com
web developer: BTGcms