The free energy and other thermodynamic properties of hexagonal-close-packed iron are calculated by direct {em ab initio} methods over a wide range of pressures and temperatures relevant to the Earths core. The {em ab initio} calculations are based on density-functional theory in the generalised-gradient approximation, and are performed using the projector augmented wave (PAW) approach. Thermal excitation of electrons is fully included. The Helmholtz free energy consists of three parts, associated with the rigid perfect lattice, harmonic lattice vibrations, and anharmonic contributions, and the technical problems of calculating these parts to high precision are investigated. The harmonic part is obtained by computing the phonon frequencies over the entire Brillouin zone, and by summation of the free-energy contributions associated with the phonon modes. The anharmonic part is computed by the technique of thermodynamic integration using carefully designed reference systems. Detailed results are presented for the pressure, specific heat, bulk modulus, expansion coefficient and Gr{u}neisen parameter, and comparisons are made with values obtained from diamond-anvil-cell and shock experiments.