In this paper, we introduce a new class of integrable systems, naturally associated to Hurwitz spaces (spaces of meromorphic functions over Riemann surfaces). The critical values of the meromorphic functions play the role of 'times'. Our systems give a natural generalization of the Ernst equation; in genus zero, they realize the scheme of deformation of integrable systems proposed by Burtsev, Mikhailov and Zakharov. We show that any solution of these systems in rank 1 defines a flat diagonal metric (Darboux-Egoroff metric) together with a class of corresponding systems of hydrodynamic type and their solutions.