Asif Pervaiz, a garment factory worker, had been accused by his supervisor of sending derogatory remarks about the Muslim Prophet Muhammad to him in a text message.
Insulting the prophet carries a mandatory death penalty in Pakistan, a predominantly Muslim country.
Pervais was convicted after a trial in Lahore that ran since 2013. His lawyer Saif-ul-Malook told Reuters he would appeal the sentence.
The court order, seen by Reuters, said Pervaiz would first serve a three-year prison term for "misusing" his phone to send the derogatory text message. Then "he shall be hanged by his neck till his death."
He was also fined 50,000 Pakistani rupees ($300), the order said.
Pervaiz told the court his supervisor made the accusation only after he had refused to convert to Islam, Saif-ul-Malook said. The complainant's lawyer, Murtaza Chaudhry, denied this was the case.
Human rights groups say blasphemy laws are often misused to persecute minorities or even against Muslims to settle personal rivalries. Islamist extremism has been on the rise in Pakistan and such accusations can end up in lynchings or street vigilantism.
A US citizen of Pakistani origin on a blasphemy trial in the northwestern city of Peshawar in July was shot dead in the courtroom by a teenager who told bystanders he killed him for insulting the Prophet Muhammad.Since his arrest, the alleged shooter has been glorified as a "holy warrior" by supporters in Pakistan and thousands of Islamists have rallied to demand his release. (