Qamar David, a hospital canteen worker, was upset about attacks on churches in Pakistan, a police chief said. A court in the southern city of Karachi remanded Mr David in custody pending a further court appearance next month.
Blasphemy can carry the death sentence in Pakistan although no-one has ever been executed for the crime.
"He was sending blasphemous messages to Muslims and was causing panic," Karachi police chief Niaz Ahmed Siddiqui told news agency Reuters.
"He says he did this as he was upset with attacks on churches in the country."
Police officer Imran Minhas said Mr David confessed to sending insulting messages about Islam and Prophet Muhammad.
Although no-one has ever been executed for blasphemy, human rights groups have criticised the law.
They say the law is often misused to settle personal vendettas and arguments over property or money, particularly against minority communities.
"It`s an arbitrary law, which has been badly misused by extremists and should be abolished," activist Asma Jehangir told news agency AFP.