Spiders and Insects are in the same Phylum (Phylum Arthropoda) but are in different classes. Phylum Arthropoda features organisms with jointed appendages, and individual body segments (or in some cases...tagmata, which are fused body segments into one, such as the head of a grasshopper, which used to be somewhere around 9 segments lonnnng ago), to name a few characteristics...
Spiders are in Class Archnida while insects are in Class Insecta
Spiders are definitely NOT mammals. Neither are Insects (Mammals belong to the class Mammalia) which is in a completely different phylum all together (chordata)
Class Insecta does indeed have 3 pairs of legs, while Arachnida has 4 pairs.
EDIT**
Should mention, common taxonomy goes
Domain
Kingdom
Phylum
Class
Order
Family
Genus
Species
For some, its far more technical than that, including subphylums and subclasses...but thats the basic run down.