We propose a spin-dependent correction to generalized gradient approximation (GGA) correlation functionals of the density functional theory. It is derived from a simple statistical constraint on one-electron densities analysis, which we found to be linearly related to atomization-energy errors. We found that this spin correction solves one of the main drawbacks of the GGA functionals optimized for the solid state, i.e., atomization energies of molecules and solids, fully preserving their accuracy for geometries and other (spin-dependent) properties.