We develop expressions for the electrostatic potential and total energy of crystalline solids which are amenable to direct evaluation in real space. Unlike conventional reciprocal-space formulations, no Fourier transforms or reciprocal lattice summations are required, and the formulation is well suited for large-scale, parallel computations. The need for reciprocal-space expressions is eliminated by replacing long-range potentials by equivalent localized charge distributions and incorporating long-range interactions into boundary conditions on the unit cell. In so doing, a simplification of the conventional reciprocal-space formalism is obtained. The equivalence of the real- and reciprocal-space formalisms is demonstrated by direct comparison in self-consistent density-functional calculations.