1. If lightning does strike, the massive current is carried down the metal, which has a much lower resistance than the masonry. This stops the masonry overheating and the mortar being broken.
2. It actually deters lightning. If the cloud has a large positive charge, it attracts electrons, which are negative, up from the ground to the tip of the spike. The large concentrated charge ionises the air molecules and then repels negative ions up to the positive charge. This neutralises some of the charge, making lightning less likely.