We consider a general, classical theory of gravity in n dimensions, arising from a diffeomorphism-invariant Lagrangian. In any such theory, to each vector field ξa on spacetime one can associate a local symmetry and, hence, a Noether current (n-1)-form j and (for solutions to the field equations) a Noether charge (n-2)-form Q-both of which are locally constructed from ξa and the fields appearing in the Lagrangian. Assuming only that the theory admits stationary black hole solutions with a bifurcate Killing horizon (with bifurcation surface Σ), and that the canonical mass and angular momentum of solutions are well defined at infinity, we show that the first law of black hole mechanics always holds for perturbations to nearby stationary black hole solutions. The quantity playing the role of black hole entropy in this formula is simply 2π times the integral over Σ of the Noether charge (n-2)-form associated with the horizon Killing field. Furthermore, we show that this black hole entropy always is given by a local geometrical expression on the horizon of the black hole. We thereby obtain a natural candidate for the entropy of a dynamical black hole in a general theory of gravity. Our results show that the validity of the ``second law'' of black hole mechanics in dynamical evolution from an initially stationary black hole to a final stationary state is equivalent to the positivity of a total Noether flux, and thus may be intimately related to the positive energy properties of the theory. The relationship between the derivation of our formula for black hole entropy and the derivation via ``Euclidean methods'' also is explained.