The five men were accused, along with six others who are on the run, of killing 74-year-old Bridget Abahime
The court in the city of Kano discharged the five men on Thursday on the legal advise of the prosecution.
"The legal advice presented to the court, dated June 24, states that there is no case to answer as the suspects are all innocent and orders the court to discharge all the suspects," the judge said in his ruling.
The five men were accused, along with six others who are on the run, of killing 74-year-old Bridget Abahime on June 2 after she allegedly insulted the Prophet Mohammed.
The suspects had pleaded not guilty of the charge.
The victim, an ethnic Igbo trader from the southeast and wife of a pastor, was beaten to death, sparking outrage across the country with President Muhammadu Buhari calling the killing "utterly condemnable".
Northern Nigeria is predominantly Muslim while the south is largely Christian and Kano city has been plagued by religious violence in the past.
In one notorious case in 1996 a trader, also an ethnic Igbo Christian, was beheaded by suspected Muslim youths who accused him of desecrating the Koran.
His severed head was hoisted on a spike and paraded around the city.