Hossam Bahgat, a human-rights lawyer who was part of al-Zainy's legal team, described the ruling as a precedent-setting victory for "women's autonomy over their body and dress code".
He said: "The court said in the strongest of terms that it is up to women to decide about their clothing, and that women should not be discriminated against because of the clothes that they choose to wear.
"A complete ban on the niqab is now outlawed as a matter of principle."
The American University in Cairo said it was consulting lawyers after the decision, but that some of the principles mentioned by the court appeared to support its position.
Court sources said the ruling does allow the university some leeway in placing restrictions on the niqab due to public necessity.
Female students, for example, could be required to reveal their faces at the university gate to a designated male security guard or female staff.
In 2001, al-Zainy was a doctoral student of English at Egypt's religious al-Azhar University but had for over a decade held privileges at the American University in Cairo library.
Bahgat said al-Zainy, who has since obtained her PhD and was pursuing the case out of principle, did not object to revealing her face at the campus gate for security reasons.
The American University in Cairo, whose campus is a prominent central Cairo landmark, said that while it recognised the need to respect the religious values of students, it had barred the niqab due to safety concerns.
Egyptian authorities have said they fear that armed Muslim groups that fought a 1992-1997 campaign to topple the government could use the niqab as a disguise.
The American University in Cairo has been seen as a potential target for such groups, and students and faculty must already pass through a metal detector and show identification cards to guards to gain access.
"The policy prohibiting face veiling was established by the university because all members of the AUC community have a basic right to know with whom they are dealing, whether in class, labs or anywhere else on campus. It is not a religious issue," the university said in a statement after the ruling.
It said the court verdict was not the final word in the case.
Amr El-Kahky, Al Jazeera's correspondent in Cairo, spoke to two students about wearing the niqab to university.
Sara Soliman, one AUC postgraduate, said: "Yes we do abide by every rule of every institution. That's the institution's right. However preventing a student from entering school because of what they wear or how they look, that is a violation of rights.
"We don't enter school wearing the niqab to do anything harmful to people"
Yasmine Adel, another AUC postgraduate, said: "Sometimes when I am driving people wonder how a veiled woman is driving. Sometimes when I'm dining at a good restaurant they feel that the niqab is stereotyped for low-class people.
"Sometimes they wonder how we mingle with people who are not veiled".