The principal eyes of jumping spiders have a unique retina with four tiered photoreceptor layers, on each of which light of different wavelengths is focused by a lens with appreciable chromatic aberration. We found that all photoreceptors in both the deepest and second-deepest layers contain a green-sensitive visual pigment, although green light is only focused on the deepest layer. This mismatch indicates that the second-deepest layer always receives defocused images, which contain depth information of the scene in optical theory. Behavioral experiments revealed that depth perception in the spider was affected by the wavelength of the illuminating light, which affects the amount of defocus in the images resulting from chromatic aberration. Therefore, we propose a depth perception mechanism based on how much the retinal image is defocused.