The evolution of spiders has been ongoing for at least 380 million years. The group's origins lie within an arachnid sub-group defined by the presence of book lungs (the tretrapulmonates); the arachnids as a whole evolved from aquatic chelicerate ancestors. More than 45,000 extant species have been described, organised taxonomically in 3,958 genera and 114 families. There may be more than 120,000 species. Fossil diversity rates make up a larger proportion than extant diversity would suggest with 1,593 arachnid species described out of 1,952 recognized chelicerates. Both extant and fossil species are described annually by researchers in the field. Major developments in spider evolution include the development of spinnerets and silk secretion.
Among the oldest known land arthropods are Trigonotarbids, members of an extinct order of spider-like arachnids.
Trigonotarbids share many superficial characteristics with spiders, including a terrestrial lifestyle, respiration through book lungs, and walking on eight legs, with a pair of leg-like pedipalps near the mouth and mouth parts. They lacked the ability to spin silk: there is no evidence for either spigots or spinnerets within the group. An unpublished fossil exists which has distinct microtubercles on its hind legs, akin to those used by spiders to direct and manipulate their silk, but given the lack of any structures associated silk production, it seems unlikely the structures were associated with silk.
Trigonotarbids are not true spiders, and the trigonotarbids have no living descendants.
According to a 2020 study using a molecular clock calibrated with 27 chelicerate fossils, spiders most likely diverged from other chelicerates between 375 and 328 million years ago.
At one stage, Attercopus was claimed as the oldest fossil spider which livedduring the Devonian. Attercopus was placed as the sister-taxon to all living spiders, but has now been reinterpreted as a member of a separate, extinct order Uraraneida which could produce silk, but did not have true spinnerets. The discovery of Chimerarachne in early Late Cretaceous (Cenomanian) aged Burmese amber has also demonstrated that taxa existed until the Cretaceous that had both spinnerets, and a whip-like telson.
The oldest reported spiders date to the Carboniferous Period, or about 300 million years ago. Most of these early segmented fossil spiders from the Coal Measures of Europe and North America probably belonged to the Mesothelae, or something very similar, a group of spiders with the spinnerets placed underneath the middle of the abdomen, rather than at the end as in modern spiders. They were probably ground-dwelling predators, living in the giant clubmoss and fern forests of the mid-late Palaeozoic, where they were presumably predators of other primitive arthropods. Silk may have been used simply as a protective covering for the eggs, a lining for a retreat hole, and later perhaps for simple ground sheet web and trapdoor construction. They co-existed with a range of spider-like forms which had some, but not all, the characters associated with the true spiders.
As plant and insect life diversified so also did the spider's use of silk. Spiders with spinnerets at the end of the abdomen (Mygalomorphae and Araneomorphae) appeared more than 250 million years ago, presumably promoting the development of more elaborate sheet and maze webs for prey capture both on ground and foliage, as well as the development of the safety dragline. The oldest mygalomorph, Rosamygale, was described from the Triassic of France. Megarachne servinei from the Permo-Carboniferous was once thought to be a giant mygalomorph spider and, with its body length of 1 foot (34 cm) and leg span of above 20 inches (50 cm), the largest known spider ever to have lived on Earth, but subsequent examination by an expert revealed that it was actually a relatively small sea scorpion.
By the Jurassic period, the sophisticated aerial webs of the orb-weaver spiders had already developed to take advantage of the rapidly diversifying groups of insects. A spider web preserved in amber, thought to be 110 million years old, shows evidence of a perfect "orb" web, the most famous, circular kind one thinks of when imagining spider webs. An examination of the drift of those genes thought to be used to produce the web-spinning behavior suggests that orb spinning was in an advanced state as many as 136 million years ago. One of these, the araneid Mongolarachne jurassica, from about, recorded from Daohuogo, Inner Mongolia in China, is the largest known fossil of a spider.
The 110-million-year-old amber-preserved web is also the oldest to show trapped insects, containing a beetle, a mite, a wasp's leg, and a fly. The ability to weave orb webs is thought to have been "lost", and sometimes even re-evolved or evolved separately, in different species of spiders since its first appearance.
Around half of modern spider species belong to the RTA clade, a group of spiders linked by the shared morphological trait of the retrolateral tibial apophysis (RTA) on the male pedipalp. Despite their modern diversity, there is no unambiguous evidence of the clade from the Mesozoic, though molecular clocks suggest that diversification of the group began in the Late Cretaceous. There appears to be a faunal turnover in the Cretaceous-Cenozoic interval, with the Cretaceous dominated by Synspermiata and Palpimanoidea, as well as enigmatic extinct families like the lagonomegopids, while the Cenozoic is dominated by RTA clade and araneoid spiders.