A suicide bomber killed at least 39 people when he blew himself up in a Shiite mosque in Kabul on Friday, officials said.