In a move described by the justice minister as “long overdue”, Chancellor Angela Merkel's left-right coalition passed a bill permitting children born intersex to be registered as “various”.
The measure follows a ruling by Germany's top tribunal last November that current regulations on civil status are discriminatory against intersex people, noting that the sexual identity of an individual is protected as a basic right.
Germany has since 2013 allowed babies born with characteristics of both sexes to leave the gender options of male and female blank.
The Federal Constitutional Court gave parliament until the end of 2018 to amend the current legislation.
The decision was in favour of an appeal brought by an intersex adult and said that courts and state authorities should no longer compel intersex people to choose between identifying as male or female.
Intersex is a broad term encompassing people who have sex traits, such as genitals or chromosomes, that do not entirely fit with a typical binary notion of male and female.
Justice Minister Katarina Barley, whose office drafted the bill, said the legislation marked a big step forward by requiring a new gender option from birth.
“No one should be discriminated against on the basis of their sexual identity,” she said, adding that the new category would give intersex people a greater sense of “dignity and positive identity”.
According to the United Nations, between 0.05 and 1.7 percent of the global population is intersex – about the same percentage that have red hair.
Sometimes this is apparent at birth, at other times it becomes noticeable in puberty.
Family Affairs Minister Franziska Giffey said the next step in Germany would be updating the legal standing of transsexual people, including barring any required medical examinations to determine a person's biological sex.
Portugal last month joined Denmark, Ireland, Malta, Norway and Sweden to become the sixth European country to grant the right to self-determination of transgender identity.
The law also prohibited surgical procedures on intersex babies so they can themselves choose their gender later in life.