We define pseudo-Riemannian spectral triples, an analytic context broad enough to encompass a spectral description of a wide class of pseudo-Riemannian manifolds, as well as their noncommutative generalisations. Our main theorem shows that to each pseudo-Riemannian spectral triple we can associate a genuine spectral triple, and so a K-homology class. With some additional assumptions we can then apply the local index theorem. We give a range of examples and some applications. The example of the harmonic oscillator in particular shows that our main theorem applies to much more than just classical pseudo-Riemannian manifolds. 2013 Elsevier B.V.