Let I^ be a Zariski dense Anosov subgroup of a connected semisimple real algebraic group -- these are higher rank analogues of convex cocompact subgroups. Let us measure the Jordan projections with any linear form which is positive on the limit cone of I^. We prove a corresponding counting theorem with a power saving error term for the conjugacy classes of loxodromic elements in I^. The proof is based on interpreting the Jordan projections as periods of a natural flow associated to I^ and proving exponential mixing. We also prove the existence of a spectral gap for the Selberg zeta function.