So how is it that spiders are more closely related to horseshoe crabs - marine arthropods that haven't changed much in the past 250 million years - than to a more obvious choice, the insects?
The answer to that question is more complex than you might think.
Up until the middle of the 20th century, before evolutionary theory was completely accepted by mainstream biology and supported by genetic analysis, taxonomists (scientists who place organisms in groups) classified organisms according to their modern anatomy. If organisms shared common physical structures (like chelicerae or mandibles) they would be placed in groups (like subphylums and classes) that put like with like. The Linnaean system of classification is still used today, but a more recent mode of classification has been able to answer how evolution plays a part in giving rise to new anatomy, and how organisms are related through common ancestry.
Common ancestry is what evolution is all about when it comes down to it, and this relatively new way of studying common ancestry is called cladistics (links to a great BBC explanation).
Open up this evolutionary tree into a new window/tab and follow along with me. This tree, a cladogram, represents the evolutionary history of all the chelicerates; spiders ("other arachnids"), horseshoe crabs ("Xiphosurida"), eurypterids, and scorpions. The cladogram labels time periods at the top from approximately 550 millions years ago (the Cambrian era) to about 250 millions years ago (the Permian era). We're mainly interested in that bracket on the bottom encompassing the "true chelicerates."
Notice on the cladogram that you can trace each group back to one point where it splits between one group and another. Take the "other arachnids" branch for example. You can trace its branch back to the split with the scorpions, and at that split there is a common ancestor from which both other arachnids - including spiders - and scorpions descended.
So basically, cladograms are family trees that evolutionary biologists can use to determine the ancestry and hierarchy of modern organisms.*
Keep tracing that line back from the common ancestor of spiders and scorpions. The next stop is the eurypterids (image above) the extinct relatives of the spider. Go even further back and there's a split between the common ancestor of eurypterids (and subsequently spiders and scorpions) and another extinct group of chelicerates, the Chasmataspida.
Finally, follow that last split back, all the way back to the Ordovician period, over 400 million years ago, to where the horseshoe crabs arose. That is where the true connection between the horseshoe crab and the spiders lies, in their common ancestry, not merely in their modern anatomical similarities.
Nowhere on this cladogram do you see insects giving rise to the spiders. In fact, modern insects would arise in later periods, millions of years after the first spiders crawled on land, although the details of the appearance of insects is still debated.
But how did spiders become distinct from their marine ancestors? The transition from water to land (and sometimes from land back to water) for all organisms is one the most interesting aspects of evolutionary biology, and though it remains somewhat of a mystery for spiders, we'll delve into the facts tomorrow.
*Cladograms are closer to what Darwin suggested for phyletic analysis in Origin of Species than the Linnaean system.