The order Friday was unusual because bail ordinarily is not granted in a blasphemy case in Pakistan, but the girl's attorney sought an exception because she is a minor. Judge Mohammad Azam Khan set bail at $10,500 for the girl, known as Rimsha, Dawn News reported.
The girl had been in a high-security prison since her arrest Aug. 16 after a mob accused her of burning pages of the Koran, the sacred book of Muslims, the BBC reported.
The judge ordered the girl into protective custody for her safety.
Prosecutors argued the teen was not entitled to bail, saying she had confessed to the allegations against her.
On Sunday, a Muslim cleric from the girl's neighborhood was arrested and accused of planting pages of the Koran in a bag belonging to the girl.
The blasphemy law is a sensitive issue in Pakistan, with some groups charging it is sometimes misused.
The minister for minority affairs was killed in March 2011 after calling for repeal of the law. Two months before that Punjab Gov. Salman Taseer was killed after speaking on the issue.