• The Supreme Court overturned a decision by a lower court that permitted a ban.
• Copies of the comic book, Avengers: The Children's Crusade, quickly sold out after the mayor's intervention.
Brazil's Supreme Court has ruled that a Marvel comic showing two men kissing can be sold despite attempts to ban it by the mayor of Rio de Janeiro.
Mayor Marcelo Crivella, a former bishop, had demanded the comic be withdrawn from a book fair, saying it included content unsuitable for minors.
The Supreme Court overturned a decision by a lower court that permitted a ban.
Copies of the comic book, Avengers: The Children's Crusade, quickly sold out after the mayor's intervention.
The Supreme Court made it illegal to ban any LGBT publication. It ruled that Mr Crivella's actions were illegal as they only targeted LGBT content.
The illustration that upset that mayor was also printed on the front page of Brazilian newspaper Folha de São Paulo on Saturday.
The picture depicts two male characters, Wiccan and Hulkling, kissing while fully clothed. In the storyline, they are portrayed as being in a committed relationship.
The Children's Crusade series has been available in Brazil since 2012. The luxury hardcover volume available at the book fair was released three years ago, according to the O Globo newspaper.
Felipe Neto, a popular Youtube star in Brazil bought 14,000 books that had LGBT themes and handed them out for free at the fair.
Marvel's first portrayal of a gay kiss was published in 1991 in its X-Force series, and a year later Northstar became the publisher's first openly gay superhero.
Gay relationships were also included years earlier in a 1985 issue of Captain America.
In a Twitter video on Friday, Mr Crivella called for issues of the comic book to be seized.
"Books like this need to be wrapped in black sealed plastic with a content warning displayed on the outside," he said in another message.
Mayor Crivella has in the past decried homosexuality as "evil behaviour," despite same-sex marriage being legal in the country since 2013.
Brazil's largest literary event "gives voice to all audiences, without distinction, as it should be in a democracy", the book fair's organisers told AFP news agency.