The woman, 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 is recognised by the law and that previous rulings were a violation of her constitutional rights.
She also said that her re-assignment surgery had been government-subsidised.
"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".
In a statement following her victory, W said: "This is a victory for all women in Hong Kong.