Abstract We propose a generalization of two classes of Lie–Hamilton systems on the Euclidean plane to two-dimensional curved spaces, leading to novel Lie–Hamilton systems on Riemannian spaces (flat 2-torus, product of hyperbolic lines, sphere and hyperbolic plane), pseudo-Riemannian spaces (anti-de Sitter, de Sitter, and Minkowski spacetimes), as well as to semi-Riemannian spaces (Newtonian or non-relativistic spacetimes). The vector fields, Hamiltonian functions, symplectic form and constants of the motion of the Euclidean classes are recovered by a contraction process. The construction is based on the structure of certain subalgebras of the so-called conformal algebras of the two-dimensional Cayley–Klein spaces. These curved Lie–Hamilton classes allow us to generalize naturally the Riccati, Kummer–Schwarz and Ermakov equations on the Euclidean plane to curved spaces, covering both the Riemannian and Lorentzian possibilities, and where the curvature can be considered as an integrable deformation parameter of the initial Euclidean system.