All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
Many scholars are of the view that it is permissible to kill the spider as it is harmful, and there is no authentic evidence, as far as we know, about the prohibition of killing it. As regards the narration reported by Abu Nu'ayim and which was narrated by Muhammad Ibn Ibraaheem At-Taymee, that the spider webbed a net on the cave where the Prophet and Abu Bakr were hiding when Quraysh wanted to kill them, and that the Prophet prohibited to kill it and said that it is among the soldiers of Allaah, then the chain of narrators of this narration is broken; and Muhammad Ibn Ibraaheem At-Taymee did not meet the Prophet .
Therefore, there is no harm on you in killing the spider if you fear that it might harm you.
Allaah Knows best.