Entanglement entropy obeys a `first law', an exact quantum generalization of the ordinary first law of thermodynamics. In any CFT with a semiclassical holographic dual, this first law has an interpretation in the dual gravitational theory as a constraint on the spacetimes dual to CFT states. For small perturbations around the CFT vacuum state, we show that the set of such constraints for all ball-shaped spatial regions in the CFT is exactly equivalent to the requirement that the dual geometry satisfy the gravitational equations of motion, linearized about pure AdS. For theories with entanglement entropy computed by the Ryu-Takayanagi formula S = /(4 G N), we obtain the linearized Einstein equations. For theories in which the vacuum entanglement entropy for a ball is computed by more general Wald functionals, we obtain the linearized equations for the associated higher-curvature theories. Using the first law, we also derive the holographic dictionary for the stress tensor, given the holographic formula for entanglement entropy. This method provides a simple alternative to holographic renormalization for computing the stress tensor expectation value in arbitrary higher derivative gravitational theories.