Asalamualaikum wrt wb,
All praise be to Allah.
The scholars say that harmful pests may be killed. However, one should never use fire to kill anything living. If the spider is harmful, it may be killed. Here is the response of the noble scholar Shaikh Ibn Baz on this issue:
Question: Is it permissible to kill insects that may be found in the house, such as ants, cockroaches and the like, by burning them? If it is not permissible, what should we do?
If these insects are harmful, they may be killed with insecticides, but not with fire. The Messenger (peace and blessings of Allaah be upon him) said: “There are five pests that may be killed whether one is in ihraam or not: rats, scorpions, crows, kites [a hawk-like bird], and mad dogs.” (Reported by Muslim, 2071). Another report adds a sixth, snakes. Thus the Prophet (peace and blessings of Allaah be upon him) told us that they are harmful pests, and that they are unlike other animals which do not do harm, and so he told us to kill them whether we are in ihraam or not. If other creatures, such as ants or cockroaches or dung-beetles, cause harm, they may also be killed with insecticides, but not with fire. And Allaah knows best.
Fataawa Islaamiyaah, Ibn Baaz, 451
And Allah knows best.