We derive the partition function of 5d \({\cal N}=1\) gauge theories on the manifold \(S^3_b \times \Sigma_{\frak g}\) with a partial topological twist along the Riemann surface, \(\Sigma_{\frak g}\). This setup is a higher dimensional uplift of the two-dimensional A-twist, and the result can be expressed as a sum over solutions of Bethe-Ansatz-type equations, with the computation receiving non-trivial non-perturbative contributions. We study this partition function in the large \(N\) limit, where it is related to holographic RG flows between asymptotically locally AdS\(_6\) and AdS\(_4\) spacetimes. We also consider cases where the 5d theory admits a UV completion as a 6d SCFT, such as the maximally supersymmetric \({\cal N}=2\) Yang-Mills theory, in which case the partition function computes the 4d index of general class \({\cal S}\) theories, which we verify in certain simplifying limits. Finally, we comment on the case of \({\cal M}_3 \times \Sigma_{\frak g}\) for more general three-manifolds, \({\cal M}_3\), which in some cases are related holographically to the entropy of black holes in AdS\(_6\).