Officials in northwest Pakistan say a suicide bomber has targeted a Shi'ite mosque, killing at least 21 people and wounding more than 30.