Switzerland has voted strongly in favour of a new law against homophobia in a referendum despite opposition from the populist right-wing Swiss People's Party (SVP).

Incomplete results show that 60.5% supported widening existing laws against discrimination or incitement to hatred on ethnic or religious grounds to include sexual orientation.

With results in from 23 out of Switzerland's 26 cantons, the preliminary figures show the highest approval rate was in Geneva with 76.3% and that the rural cantons of Appenzell Innerrhoden, Schwyz and Uri voted against.

The change was passed by the Swiss parliament in 2018 but critics, who believe it will end up censoring free speech, forced a referendum on the issue.

All of Switzerland's major parties except the SVP, the biggest political force in parliament, support the law.

Under the new law, homophobic comments made in a family setting or among friends would not be criminalised.

But publicly denigrating or discriminating against someone for being gay or inciting hatred against that person in text, speech, images or gestures, would be banned.

The government has said it will still be possible to have opinionated debates on issues such as same-sex marriage, and the new law does not ban jokes - however off-colour.

"This is a historic day," Mathias Reynard, a lawmaker from the Social Democratic Party of Switzerland who initiated the reform, told Swiss channel RTS 1.

"It gives a signal which is magnificent for everyone and for anyone who has been a victim of discrimination," he said.

Gay rights campaigners were divided over the legislation.

A group called "No to Special Rights!" is opposed, arguing that the gay community does not need special protection.