Glynn Simmons, who is recorded as the longest wrongfully imprisoned person in US history, was released in July after a judge ordered a retrial.
On Monday, a district attorney said there was no evidence to warrant a retrial.
But Oklahoma District Judge Amy Palumbo ruled Tuesday that he was innocent.
"This court finds by clear and convincing evidence that the crime for which Mr. Simmons was convicted and imprisoned was not committed by him," Palumbo said.
Simmons told reporters after the court's decision, "This is a lesson in resilience and perseverance. Don't let anyone tell you it can't happen, because it really can," Simmons told reporters after the verdict.
Simmons was tried for the murder of Carolyn Sue Rogers during the robbery of a liquor store in Oklahoma City, and was convicted and sentenced to death along with Don Roberts in 1975.
The sentences were later commuted to life imprisonment.
Simmons said he was in his home state of Louisiana when the murder took place.
PROSECUTORS DID NOT SHOW ALL THE EVIDENCE
In July, it was revealed that prosecutors had not shown defense lawyers all the evidence they had, an eyewitness identified other suspects, and Simmons' sentence was overturned.
Roberts was paroled in 2008.
In the US state of Oklahoma, wrongfully imprisoned people can be compensated up to 175 thousand dollars.
Simmons, who is currently battling liver cancer, had raised thousands of dollars in donations for his living expenses and chemotherapy treatment.