Aims. Our goal is to find the relation between the two-point correlation functions (CFs) of projected and spatial density fields of galaxies in the context of the cosmic web. Methods. To investigate relations between spatial (3D) and projected (2D) CFs of galaxies we used density fields of two simulations: a $Lambda$-dominated cold dark matter (LCDM) model with known particle data, and the Millennium simulation with know data on simulated galaxies. We compare 3D and 2D correlation functions. In the 2D case, we use samples of various thickness to find the dependence of 2D CFs on the thickness of samples. We also compare 3D CFs in real and redshift space. Results. The dominant elements of the cosmic web are clusters and filaments, separated by voids filling most of the volume. In individual 2D sheets, the positions of clusters and filaments do not coincide. As a result, in projection, the clusters and filaments fill in 2D voids. This leads to a decrease in the amplitudes of CFs (and power spectra) in projection. For this reason, the amplitudes of 2D CFs are lower than the amplitudes of 3D correlation functions: the thicker the 2D sample, the greater the difference. Conclusions. Spatial CFs of galaxies contain valuable information about the geometrical properties of the cosmic web that cannot be found from projected CFs.