We report significant details of the magnetic structure and spin dynamics of LiFePO4 obtained by single-crystal neutron scattering. Our results confirm a previously reported collinear rotation of the spins away from the principal b axis, and they determine that the rotation is toward the a axis. In addition, we find a significant spin-canting component along c. The possible causes of these components are discussed, and their significance for the magnetoelectric effect is analyzed. Inelastic neutron scattering along the three principal directions reveals a highly anisotropic hard plane consistent with earlier susceptibility measurements. Using a spin Hamiltonian, we show that the spin dimensionality is intermediate between XY- and Ising-like, with an easy b axis and a hard c axis. It is shown that both next-nearest neighbor exchange couplings in the bc plane are in competition with the strongest nearest neighbor coupling.