Germany's top court on Wednesday ruled lawmakers must legally recognise a "third gender" from birth.
Since 2013, it was possible to leave the gender box blank on birth certificates, for those born as intersex.
The new legislation must be in force by December 31, 2018, the court said.
Berlin pledged to follow through with the ruling, with interior ministry spokesman Johannes Dimroth saying that the government "stands ready to implement it".
In its ruling (in German), the court said: "Because [the plaintiff's] intersex identity is clear and lasting, they are entitled to equal recognition of their gender as a manifestation of their general personality rights".More news: In Japan, Trump presented an unusual gift
More news: Meek Mill sentenced to at least two years in Pennsylvania state prison
More news: Trump administration to end TPS for Nicaraguans. No decision on Haitians, Salvadorans
The plaintiff had brought the appeal after several lower courts had ruled against a bid to introduce the gender options "inter" or "various" in the birth register.
Intersex people are born with a mixture of male and female sex characteristics.
"Research suggests, however, that in a few births per thousand some individuals will be born with a single sex chromosome (45X or 45Y) (sex monosomies) and some with three or more sex chromosomes (47XXX, 47XYY or 47XXY, etc.) (sex polysomies)", the World Health Organization explained, adding that other intersex cases involve 46XY individuals being born female due to a mutation on the Y-chromosome. "An intersex person may be straight, gay, lesbian, bisexual or asexual, and may identify as female, male, both or neither". "We are completely overwhelmed and speechless".
The court said this could mean doing away with gender in official registration altogether, or "adding a positive designation of a gender" such as the terms suggested by the complainant: "inter/diverse" or "diverse". "That's a small revolution in the gender area", the group said in a tweet.
The UN believes between 0.05 and 1.7 per cent of the global population is intersex - about the same percentage that have red hair.
New York, America's largest and one of its most liberal cities, previous year issued the first United States birth certificate marked "intersex".