Jamat-ul-Ahrar, an organisation linked to the Pakistani Taliban, said the suicide bombing in Charsadda district was in retaliation for Pakistan's hanging of Mumtaz Qadri.
The death toll from blast, which struck a court building in the town of Shabqadar, rose overnight to 17 after six more people died from their injuries.
Mr Qadri was executed last week for the 2001 killing of Salman Taseer, a provincial governor who openly opposed Pakistan's blasphemy laws, which have been used against Christians and other minority groups.
Mr Taseer had also called for a Christian woman who was sentenced to death for insulting the Prophet Muhammad, to be pardoned.
Claiming responsibility for Monday's explosion in Shabqadar, Jamat-ul-Ahrar said it as an attack on the judiciary which "gives verdicts against God's divine laws".
Jamat-ul-Ahrar is understood to have carried out blasts at two churches in Lahore in March last year, where 15 people died and 70 were hurt.
The group has been part of a war against the Pakistan state for more than a decade.
The country's military said it's entered the final stage of an offensive in the region, reporting air strikes killed 21 militants overnight.