We present an efficient implementation of the van der Waals density functional of Dion et al. [Phys. Rev. Lett. 92, 246401 (2004)], which expresses the nonlocal correlation energy as a double spatial integral. We factorize the integration kernel and use fast Fourier transforms to evaluate the self-consistent potential, total energy, and atomic forces, in O(NlogN) operations. The resulting overh...