Hong Kong's court of appeal has ruled that a British lesbian who moved to the territory with her partner should be granted a dependent visa.
The visa, usually given to the husbands and wives of foreigners working in Hong Kong, was denied because she was not considered a spouse, the woman said.
Same-sex marriage is banned in the territory although discrimination based on sexual orientation is illegal.
Campaigners say this is a landmark case that could lead to greater equality.
The woman, who has been identified as QT, entered into a civil partnership in England in 2011 after more than seven years with her partner.
In the same year, the couple moved to Hong Kong after QT's partner was offered a job there.
QT said that applications to the Immigration Department had been rejected after officials refused to recognise her UK-registered partnership.
In a unanimous ruling by three judges, the Court of Appeal said immigration authorities had "failed to justify the indirect discrimination on account of sexual orientation that QT suffers".
"Times have changed and an increasing number of people are no longer prepared to accept the status quo without critical thought," chief judge Andrew Cheung wrote.
The decision overturned a ruling by a lower court last year and ordered Hong Kong's Immigration Department and QT to work together on an agreement and submit it to the court within 28 days.
Hong Kong's LGBT campaigners welcomed the decision with Ray Chan, the city's first openly gay lawmaker, describing it as a "big win for same-sex dependents to apply for visa to stay in Hong Kong".
The Equal Opportunities Commission said it was time for the government to consider a legal framework and policy measures to recognise same-sex relationships and protect LGBT rights.
It is not illegal to be gay in China but homosexuality was considered to be a mental disorder until 2001 and attitudes towards it remain conservative.