The main result in this paper is a fixed point formula for equivariant indices of elliptic differential operators, for proper actions by connected semisimple Lie groups on possibly noncompact manifolds, with compact quotients. For compact groups and manifolds, this reduces to the Atiyah-Segal-Singer fixed point formula. Other special cases include an index theorem by Connes and Moscovici for homogeneous spaces, and an earlier index theorem by the second author, both in cases where the group acting is connected and semisimple. As an application of this fixed point formula, we give a new proof of Harish-Chandra's character formula for discrete series representations.