Superior Court Judge Elden Fox ruled in favor of a prosecution motion to dismiss the charge that Ryder was illegally carrying painkillers when she was arrested last Dec. 12 outside a Saks Fifth Avenue store in Beverly Hills.
"It's unfortunate it's taken them 10 months to do this," said Mark Geragos, Ryder's attorney. "I applaud them."
Geragos said prosecutors had evidence almost immediately after Ryder's arrest that she had a prescription for the two pills, a generic form of the painkiller Percocet.
"The worst thing you can say is that she was trying to save a couple of bucks," Geragos quipped outside court in reference to the generic pills.
Deputy District Attorney Ann Rundle said after the hearing that the charge was dropped after defense lawyers provided a sworn declaration from Ryder's doctor that he'd given her the Oxycodone pills without a prescription.
"The responsibility for providing the drug would be the doctor's," said Sandi Gibbons, a spokeswoman for the Los Angeles County District Attorney's Office. "Therefore, the criminal responsibility is not (Ryder's)."
Gibbons said there was an ongoing investigation into how the actress obtained the pills, but declined further comment.
Ryder, accused of shoplifting $6,000 worth of merchandise, will stand trial on the remaining charges of felony grand theft, burglary and vandalism. She faces up to three years in prison if convicted.
The 30-year-old star of such films as "Girl, Interrupted" and "Heathers" smiled at court employees and seemed upbeat as she chatted with the bailiff before the hearing, but she didn't speak during the proceedings and offered no comment while leaving the courtroom.
The hearing was delayed Tuesday after Geragos was unable to attend because of his involvement in an attempted murder trial in another court.