The parameter estimation problem is discussed for differential equations that describe a Hamiltonian system. Since the conserved total energy is an invariant which contains all parameters of the system, we can achieve parameter estimation without any numerical integration. This is demonstrated for data in the chaotic region of the Hénon-Heiles system and of the planar double pendulum. We show that the method works well for ideal as well as noisy data. In this context, an appropriate method for the generation of reliable time series in the presence of an invariant is discussed. Finally, it is shown that our method also provides a simple approach to global fitting in discrete dynamical systems with invariants.