Abstract: Spiders contribute considerably to diversity in agroecosystems and are important components of natural pest control. Farming system and adjacent habitats may influence spider diversity. In this study, diversity of the spider families Lycosidae and Linyphiidae was studied after spring sowing until the time when a common pest (Rhopalosiphum padi) colonizes cereal fields. The spiders were collected with pitfall traps at eight organically or conventionally managed farms around Uppsala, Sweden, in three different habitats at each site: field margin, crop field and the edge between the two. The effects of farming system and habitat type on diversity of lycosids and linyphiids were considered using three different measures (activity density, species richness and composition). The most dominant species of each spider family, Pardosa agrestis (Lycosidae) and Oedothorax apicatus (Linyphiidae), had higher activity density at organic sites, and farming systems also contained different species compositions of both lycosid and linyphiid spiders. Also, linyphiid species richness was higher on conventional sites and linyphiid species composition was influenced by habitat type, in contrast with lycosids. Activity density and species richness of lycosid spiders were, on the other hand, more associated with field margins than linyphiid spiders.