Complexation of a polyelectrolyte with an oppositely charged spherical macroion is studied for both salt-free and salty solutions. When a polyelectrolyte winds around the macroion, its turns repel each other and form an almost equidistant solenoid. It is shown that this repulsive correlations of turns lead to the charge inversion: more polyelectrolyte winds around the macroion than it is necessary to neutralize it. The charge inversion becomes stronger with increasing concentration of salt and can exceed 100%. Monte-Carlo simulation results agree with our analytical theory.