Rimsha Masih was arrested in August when she was reportedly caught holding a bag of rubbish with burnt pages in it.
An official medical report classified her as "uneducated" and 14 years old but with a mental age younger than her years.
Others have said she is as young as 11 and suffers from Down syndrome.
Rimsha spent three weeks on remand in an adult jail facing charges of blasphemy, which is punishable by death.
She was released on bail in September and police have since told the courts she was not guilty and that a cleric who allegedly framed her should face trial instead.
A court in Islamabad has now thrown out all of the charges.
"The court has quashed the case, declaring Rimsha innocent," her lawyer Akmal Bhatti said.
Paul Bhatti, the only Christian member of Pakistan's federal cabinet, welcomed the "historic" move, saying justice had been done.
"It will send out a positive image of Pakistan in the international community that there is justice for all and that society has risen up for justice and tolerance," he said.
He paid tribute to Muslim clerics, members of the media and civil society for also playing a "positive role" in highlighting the injustice done to Rimsha.
"The historic decision will deter people from levelling false accusations against others," he said.
The prosecution said it would appeal the decision.
Rimsha and her family, who have been in fear for their lives since the allegations broke, had been moved to an undisclosed location after her release on bail.
The cleric who gave police burned papers as evidence against her was detained on September 1 for himself allegedly desecrating the Koran and tampering with evidence.
He was also granted bail last month.