It is essential that you fully understand the difference between being resident in Spain and being tax resident in Spain. The two things are quite different and can have a profound impact upon you and your family, particularly with regard to inheritance tax.
If you intend to reside in Spain for longer than three months then you must apply to go on the National Foreigner’s Registry (Registro Central de Extranjeros, which can be done when you apply for your NIE number. However, registration on the National Foreigner’s Registry does not mean that you are tax resident.
To be tax resident in Spain you must make an annual tax declaration to the Spanish tax office. This will be deemed as mandatory according to a number of factors such as: if you live in Spain for 183 days a year or longer or if your main and primary residence is in Spain or if your spouse and children live in Spain or your main economic interest is in Spain.
The vital point is that you must actually make a tax return to the Spanish tax authorities (even if it amounts to a nil return) to be designated as tax resident and thereby eligible for free healthcare (see below) and tax exemptions on inheritance tax. Importantly, if you are deemed to have been tax resident and you have not made an annual tax return then you will not be eligible for tax exemption.