We study the geodesic flow on the cotangent bundle of a Friedmann–Robertson–Walker (FRW) spacetime (M, g). On this bundle, the Hamilton–Jacobi equation is completely separable and this property allows us to construct four linearly independent integrals in involution, i.e. Poisson commuting amongst themselves and pointwise linearly independent. As a consequence, the geodesic flow on an FRW background is completely integrable in the Liouville–Arnold sense. For a spatially flat or spatially closed universe, we construct submanifolds that remain invariant under the action of the flow. For a spatially closed universe these submanifolds are topologically R × S1 × S1 × S1, while for a spatially flat universe they are topologically R × R × S1 × S1. However, due to the highly symmetrical nature of the background spacetime, the four integrals in involution also admit regions where they fail to be linearly independent. We identify these regions although we have not been able in a mathematically rigorous fashion to describe the structure of the associated invariant submanifolds. Nevertheless, the phase space trajectories contained in these submanifolds when projected on the base manifold describe radial timelike geodesics or timelike geodesics ‘comoving’ with the cosmological expansion.