We present an implicit solvent model for ab initio electronic structure calculations which is fully self-consistent and is based on direct solution of the nonhomogeneous Poisson equation. The solute cavity is naturally defined in terms of an isosurface of the electronic density according to the formula of Fattebert and Gygi (J. Comp. Chem. 23, 6 (2002)). While this model depends on only two parameters, we demonstrate that by using appropriate boundary conditions and dispersion-repulsion contributions, solvation energies obtained for an extensive test set including neutral and charged molecules show dramatic improvement compared to existing models. Our approach is implemented in, but not restricted to, a linear-scaling density functional theory (DFT) framework, opening the path for self-consistent implicit solvent DFT calculations on systems of unprecedented size, which we demonstrate with calculations on a 2615-atom protein-ligand complex.