Cosby gave the deposition in 2005 during a civil suit.
He described offering drugs to women he wanted to have sex with, and he admitted to drugging and fondling the woman he's accused of assaulting.
Cosby's defense team fought the use of the decade-old out-of-court testimony on grounds the comedian originally gave it with the understanding he wouldn't be charged.
But the judge found that deal wasn't ever made official or put in writing.
Prosecutors see this as one win in a two-part effort to build a case based on apparent patterns in Cosby's sexual behavior.
The judge also has to decide whether to allow up to 13 of Cosby's more than 50 accusers to testify in the trial.
The trial is set for June 2017.