Potassium intercalation in graphite is investigated by first-principles theory. The bonding in the potassium-graphite compound is reasonably well accounted for by traditional semilocal density functional theory (DFT) calculations. However, to investigate the intercalate formation energy from pure potassium atoms and graphite requires use of a description of the graphite interlayer binding and thus a consistent account of the nonlocal dispersive interactions. This is included seamlessly with ordinary DFT by a van der Waals density functional (vdW-DF) approach [Phys. Rev. Lett. 92, 246401 (2004)]. The use of the vdW-DF is found to stabilize the graphite crystal, with crystal parameters in fair agreement with experiments. For graphite and potassium-intercalated graphite structural parameters such as binding separation, layer binding energy, formation energy, and bulk modulus are reported. Also the adsorption and sub-surface potassium absorption energies are reported. The vdW-DF description, compared with the traditional semilocal approach, is found to weakly soften the elastic response.