The Madrid court considered that both parties were “jointly responsible” and “co-caretakers” of Panda the dog.
A lawyer who brought the case to court said it was a “pioneering” ruling.
Spain is currently drafting new legislation so that animals are no longer considered objects and are legally recognised as living beings.
This status would make it easier for a partner to request joint custody of a pet following a breakup.
But Lola García, from the Law & Animals law firm, brought this case to court under the 1987 European Convention for the Protection of Pet Animals, which Spain ratified in 2017.
She said it was a “pioneering ruling” because her client was able to declare herself not as a “co-owner” of Panda but as “co-responsible” and as a “co-carer”.
Panda’s adoption contract, veterinary bills and photographs where “the three are seen as a family, exactly the same as if it were a family photo with children” were submitted as evidence, Ms García said, according to RTVE.
The judge ruled that “the evidence in the proceedings reveals an affective relationship between the plaintiff and the dog that is worthy of legal guardianship”.
Panda will now alternate between the two partners for a month at a time.
Dog custody laws around the world
In the UK, dogs are legally seen as inanimate objects akin to cars, houses or other personal items. Custody cases come down to determining who the sole owner is.
In Australia, there is no legislation as to how to courts should navigate living arrangements for pets after a breakup.
France changed its law in 2014 so that pets were considered “living and feeling beings” rather than “movable goods”. The new status meant that couples could fight for shared custody in divorce cases.