President Jair Bolsonaro.

Mr Bolsonaro had suggested last year that Patrícia Campos Mello had offered sex to a source for negative information about him.

The judge said Mr Bolsonaro’s remarks had damaged the journalist’s honour. The president was told to pay her 20,000 reais (Sh392,727) in damages. He can appeal the ruling.

In a tweet, Ms Campos Mello, an award-winning reporter for Brazilian daily newspaper Folha de S.Paulo, said the judge’s decision was a “victory for all of us women”.

The Journalists Against Harassment group said the ruling marked a “great day” for female reporters and professional journalism in Brazil.

Bolsonaro, a right-wing president who has been in office since January 2019, has a history of animosity towards journalists who have been critical of his administration.

Campos Mello brought legal action against him in response to comments made in February 2020. In its report about the remarks, the Folha newspaper accused Bolsonaro of insulting Campos Mello with sexual innuendo.

Bolsonaro said the journalist “wanted a scoop” at “any price against me”, the newspaper reported the president as saying.

Campos Mello wrote a series of investigative reports about a group using WhatsApp to boost Mr Bolsonaro’s campaign by denigrating his rivals ahead of the 2018 presidential election.

In January, Campos Mello won an almost identical case against the president’s son, Eduardo, who is a member of parliament in Brazil’s lower house of Congress.

He had suggested in a YouTube video last May that the reporter had “tried to seduce” a source for damaging information against his father.