The child, known only as Carla, identifies as a girl but has no female reproductive organs, Family Court documents show.
The court approved a request by Carla's parents to surgically remove male gonads inside her body.
People with a combination of sex characteristics are called intersex.
'Stereotypically female' behaviour
New York Magazine published a story Sunday about a woman whose business teaches transgender women how to be feminine. Photo: Truth Revolt
When Carla turned five, her parents wanted to clarify if they needed court permission for the complex and irreversible surgery.
The Family Court heard Carla was born with female-appearing genitalia and exhibited "stereotypically female" behaviour, which included never wanting to be referred to as a male and a preference for "female toys, clothes and activities".
Court documents seen by the BBC show medical experts testified that surgery would remove the risk of Carla developing tumours and that she had no certainty of future fertility. The surgery should happen before puberty, they said.
What is intersex?
If you are born with a mix of male and female sexual characteristics, this means you have a disorder or difference of sex development (DSD), also known as being intersex.
There are numerous different conditions which come under this umbrella term. Taken together, they are more common than you might think - experts say perhaps one in 2,000 babies are born with some kind of sex development difference.
These conditions occur when the reproductive organs and genitals do not develop as expected.
As a result, you might have female sex chromosomes but your reproductive organs and genitals are male - or the opposite way round. Or you may have a mixture of male and female organs and genitals, or some that are neither clearly male nor female.
This occurs because of how your particular genes respond to the sex hormones in your body.
DSDs can be treated with hormone therapy, psychological support and - sometimes - surgery.
The court ruled the parents did not need permission to arrange surgery. The ruling was made in January but it was not immediately made available to the public, The Australian newspaper said.
"I consider the proposed medical treatment 'therapeutic' as being necessary to appropriately and proportionately treat a genetic bodily malfunction that, untreated, poses real and not insubstantial risks to the child's physical and emotional health," Family Court Judge Colin Forrest said in making his ruling.
Campaigners question surgery
Some intersex campaigners have challenged the ethical basis of irreversible surgery, arguing that gender identity is complex.
One advocate, Morgan Carpenter, told the BBC that children should decide their identity for themselves when they are older.
"Gender assignment is always appropriate," he said. "What is not appropriate is surgically enforced gender assignment."
One of the first examples of the “Genderbread Person” which has now updated. Photo: Medium
Mr Carpenter said he believed medical and legal professionals often wrongly approached variations in sex development as disorders in need of correction.
"We need clinicians to consult the community to develop non-surgical options," he said.
Some terms used to discuss gender identity
Intersex: Applies to a person with a combination of sex characteristics - chromosomes, genitals or reproductive organs - neither solely male nor female.
Non-binary: Applies to a person who does not identify as "male" or "female".
Genderqueer: Similar to non-binary, sometimes shortened to "queer", an ambiguous word that can also be used to describe a person's sexual orientation, eg lesbian, gay or bisexual.
Transgender: Applies to a person whose gender is different from their "assigned" sex at birth, often shortened to "trans".
Transgender Photo: TIME