Brody blamed police and prosecutors for shoddy work and said the prosecution was based on shaky eyewitness identification, the testimony of another man who said he saw Dennis with the gun the night of the murder, and the description of clothing seized from Dennis' father's house that police lost before it could be photographed or cataloged.
The District Attorney's Office now has 180 days to retry Dennis or free him.
Dennis' attorneys called the ruling a victory - which comes exactly a week before their client's 43rd birthday.
"Today is a victory for justice," one of the attorneys, Ryan Guilds, said in a statement. "For the lawyers on this case, many of whom have spent nearly their entire professional lives working on behalf of Mr. Dennis, today's ruling is an indescribable professional triumph. For Mr. Dennis, it is even more - it is an affirmation of his innocence and a chilling reminder that he has spent over two decades on death row for a crime he did not commit."
According to testimony in the case, Williams and a friend were approached by two men who demanded her earrings. One of the men held a gun to Williams' neck and shot her. Both men then fled in a car driven by a third person.
The gun was never recovered, nor was there any physical evidence linking Dennis to the crime. Dennis, who was a singer at the time, maintained he was taking the K bus from his father's home to the Abbotsford Homes at the time of the murder.
Brody's ruling also said police and prosecutors failed to turn over a statement from a Montgomery County inmate who told police he had a conversation with two men who claimed they were involved with Williams' murder. The inmate's statement allegedly contained intimate details about the shooting.
Brody also criticized defense attorney Lee Mandell for failing to interview the eyewitnesses. She said he also erred in not having the testimony of Charles Thompson - who claimed he saw Dennis with a gun the night of the murder - thrown out because Thompson went to police only after he was arrested for assault.
Mandell declined to respond to the judge's criticism, but said he believed in Dennis' innocence.
"It's always good to see somebody get a new trial when they're facing what he's facing," he said.
The victim's mother, Barbara Williams, was disturbed upon hearing the news in the case from a Daily News reporter.
"I'm really disappointed about that with all that's going on with so many kids that are getting shot the same way my daughter was," she said.
She said Assistant District Attorney Roger King did an excellent job of clearly laying out what happened.
"I have the chills just thinking about the whole [thing]. I can't think of him getting out," she said.
District Attorney Seth Williams said in a statement that he was disappointed with the decision, saying Dennis' lawyers presented "slanted factual allegations."
"Three passers-by saw him do it and identified him in court, without any possible motive to lie," Williams' statement said. "The defendant had a record of arrests for armed robberies, and after this case he pleaded guilty to shooting yet another robbery victim in a different case. His newly concocted alibi defense in this case was based on allegations that were proven to be lies at a post-trial hearing."
Williams said his office will consider whether to retry Dennis.
Marc Bookman, director of the nonprofit Atlantic Center for Capital Representation, said the case highlights the pitfalls of capital punishment.
"This is not an outlier. The commonwealth has an obligation to provide Brady evidence - evidence of innocence. Until there's a punishment for not turning it over, then we're going to continue seeing these sorts of cases," said Bookman, who spent 27 years in the Philadelphia public defender's office.
"As long as human beings are tasked with such an incredibly important job, mistakes are going to be made. Here, the mistakes were intentional," Bookman added. "Even unintentional mistakes might lead to someone's execution."
On Twitter: @ChroniclesofSol