Aims. Our goal is to find how the spatial correlation function of galaxies describes the multifractal nature of the cosmic web. Methods. We calculate spatial correlation functions of galaxies, ξ(r), structure functions, g(r) = 1 + ξ(r), and fractal dimension functions, D(x) = 3 + γ(r) = 3 + d log g(r)/d log r, using dark matter particles of biased Λ cold dark matter (CDM) simulation, observed galaxies of the Sloan Digital Sky Survey (SDSS), and simulated galaxies of the Millennium and EAGLE simulations. We analyse how these functions describe fractal and other geometrical properties of the cosmic web. Results. Correlation functions of biased ΛCDM model samples describe at small distances (particle/galaxy separations), r ≤ 2.25 h −1 Mpc, the distribution of matter inside DM halos. In real and simulated galaxy samples only brightest galaxies in clusters are visible, and the transition from clusters to filaments occurs at distance r ≈ 0.8 − 1.5 h −1 Mpc. On larger separations correlation functions describe the distribution of matter and galaxies in the whole cosmic web. The effective fractal dimension of the cosmic web is a continuous function of the distance (separation). On small separations, r ≤ 2 h −1 Mpc, the fractal dimension decreases from D ≈ 1.5 to D ≈ 0, reflecting the distribution inside halos/clusters. The minimum of the fractal dimension function D(r) near r ≈ 2 is deeper for more luminous galaxies. On medium separations, 2 ≤ r ≤ 10 h −1 Mpc, the fractal dimension grows from ≈ 0 to ≈ 2, and approaches at large separations 3 (random distribution). Real and simulated galaxies of low luminosity, M r ≥ −19, have almost identical correlation lengths and amplitudes, indicating that dwarf galaxies are satellites of brighter galaxies, and do not form a smooth population in voids. Conclusions. Spatial correlation functions of galaxies contain valuable information on fractal dimension and other geometrical properties of the cosmic web.