Reading spiritual books and associating with people aspiring to lead a pure life gives us the immunity from black magic spells.
Read this post on radhanath-swami.net