A transgender woman in Hong Kong has won a groundbreaking court appeal allowing her to marry her boyfriend and forcing the government to rewrite the city's marriage laws.

The woman in her 30s, known in the Court of Final Appeal as "W" under anonymity rules, successfully overturned earlier verdicts that said marriage is only allowed between couples who were of the opposite sex at birth.

W, who underwent sex realignment surgery more than five years ago, argued that her post-operative gender was recognised by the law and that previous rulings were a violation of her constitutional rights.

I have lived my life as a woman and been treated as a woman in all respects except as regards to my right to marry. This decision rights that wrong - W, transgender woman allowed to marry,

She also said that her reassignment surgery had been government-subsidised.

The city's Registrar of Marriages had argued that she could not wed her boyfriend because her birth certificate - which cannot be altered under Hong Kong law - said she was male.

"It is contrary to principle to focus merely on biological features fixed at the time of birth," the court said in a written judgement by the panel of five judges.

It added that existing laws "impair the very essence of W's right to marry".

One out of the five judges rejected the appeal.

The court said the nature of marriage as a social institution had "undergone far-reaching changes" in multi-cultural present-day Hong Kong.

"The effect of this decision is that W will be allowed to marry, and should be allowed to marry her boyfriend," lawyer for W, Michael Vidler, told reporters outside the courthouse after the ruling was announced.

"This is a case about sexual minorities being recognised and that their rights are just as important as everyone else's," Vidler said of what he called a "landmark decision".

W, who was not in court on Monday, said in a statement read by Vidler: "I have lived my life as a woman and been treated as a woman in all respects except as regards to my right to marry. This decision rights that wrong."

"I am very happy that the court of appeal now recognises my desire to marry my boyfriend one day and that that desire is no different to that of any other women who seek the same here in Hong Kong," W said. "This is a victory for all women in Hong Kong."

The court will suspend the decision for 12 months, allowing time for the government to amend the city's marriage laws.