Spectral Galerkin methods for a weakly singular Volterra integral equation of the second kind