We present a real-space method for electronic-structure calculations of periodic systems. Our method is based on the self-consistent solution of the Kohn-Sham equations on a uniform three-dimensional grid. A higher-order finite-difference method is combined with ab initio pseudopotentials. The kinetic energy operator, the nonlocal term of the ionic pseudopotential, and the Hartree and exchange-correlation potentials are set up directly on the real-space grid. The local contribution to the ionic pseudopotential is initially obtained in reciprocal space and is then transferred to the real-space grid by Fourier transform. Our method enjoys the main advantages of real-space grid techniques over traditional plane-wave representations for density-functional calculations, i.e., improved scaling and easier implementation on parallel computers. We illustrate the method by application to liquid silicon.