By Agence France-Presse
Same-sex marriage is not legally recognised in Japan but the government has gradually expanded rights protections for its lesbian, gay, bisexual and transgender citizens in recent years.
The Taiwanese man, now in his 40s, has lived in the country for about 25 years with his Japanese partner, now in his 50s, according to national broadcaster NHK.
He was arrested in 2016 for overstaying a three-month visa from the early 1990s and was ordered to be deported, the Tokyo Shimbun newspaper reported.
But he appealed the government's order, claiming that a special residency permit would have been issued to heterosexual couples in similar situations.
Tokyo cancelled its deportation order this month and issued the special residency permit to the Taiwanese man, NHK reported.
"If we could have married legally, our lives could have changed," he told local media Friday, according to the Tokyo Shimbun.
His Japanese partner said: "Our lives and future seemed grey. Now I wish that two of us will live with more positive attitude and a sense of gratitude to make the colour of our lives a bit brighter."
In recent years, Japan's LGBT population has campaigned for greater recognition from the government.
In February, 13 same-sex couples filed suits, accusing the Tokyo of discrimination for failing to recognise their unions.
They argue that they are being denied rights accorded to heterosexual couples and hope courts will declare the government's position unconstitutional.