Among democratic countries in the developed world, Japan ranks low on gender equality in health, education, the economy and politics. Despite recent high-profile examples, women hold very few powerful positions in politics or business, while many working mothers say that day care is inadequate.

The marital naming law, supported by many conservatives who believe that women belong predominantly in the home supporting their husbands and families, is seen by some as another vestige of discrimination against women in Japanese society.

In the Tokyo District Court case, the three judges, all men, ruled that the teacher’s employer, a private school in Tokyo, could not be compelled to let her use her birth surname at work. Citing surveys that show about a quarter of women use their original surnames in the workplace, the court said doing so was “not deeply rooted in society.”

The plaintiff, who has remained anonymous in the publicly available court documents, declined an interview request through her lawyer. In court filings, the teacher, described as recently married, said students and colleagues knew her by her given surname. She asked to be allowed to continue to use it on letters home to parents, attendance records and report cards.

Makiko Terahara, one of the lawyers for the plaintiff, said the teacher, now in her 30s, had worked for 15 years using her birth surname.

“We have to work on changing the law so that couples can choose their names when marrying,” Ms. Terahara said. “A name represents a person. It’s a matter of personal rights.”

Hidehisa Takase, the principal of Nihon University Daisangakuen, the school where the plaintiff works, said he had offered a compromise in which the teacher could continue to be called by her birth name publicly but use her married name for official documents, including student report cards.