A fast and well-conditioned spectral method