Animal rights campaigners filed a habeas corpus petition - a document more typically used to challenge the legality of a person's detention or imprisonment - in November on behalf of Sandra, a 29-year-old Sumatran orangutan at the Buenos Aires zoo.
In a landmark ruling that could pave the way for more lawsuits, the Association of Officials and Lawyers for Animal Rights argued the ape had sufficient cognitive functions and should not be treated as an object.
The court agreed Sandra, born into captivity in Germany before being transferred to Argentina two decades ago, deserved the basic rights of a "non-human person."
"This opens the way not only for other great apes, but also for other sentient beings which are unfairly and arbitrarily deprived of their liberty in zoos, circuses, water parks and scientific laboratories," the daily La Nacion newspaper quoted AFADA lawyer Paul Buompadre as saying.
Orangutan is a word from the Malay and Indonesian languages that means "forest man."
Sandra's case is not the first time activists have sought to use the habeas corpus writ to secure the release of wild animals from captivity.
A U.S. court this month tossed out a similar bid for the freedom of "Tommy" the chimpanzee, privately owned in New York state, ruling the chimp was not a "person" entitled to the rights and protections afforded by habeas corpus.
In 2011, the animal rights group People for the Ethical Treatment of Animals filed a lawsuit against marine park operator SeaWorld, alleging five wild-captured orca whales were treated like slaves. A San Diego court dismissed the case.
The Buenos Aires zoo has 10 working days to seek an appeal.
A spokesman for the zoo declined to comment to Reuters. The zoo's head of biology, Adrian Sestelo, told La Nacion that orangutans were by nature calm, solitary animals which come together only to mate and care for their young.
"When you don't know the biology of a species, to unjustifiably claim it suffers abuse, is stressed or depressed, is to make one of man's most common mistakes, which is to humanize animal behavior," Sestelo told the daily.