We provide a contour integral formula for the exact partition function of N = 2 supersymmetric U(N ) gauge theories on compact toric four-manifolds by means of supersymmetric localisation. We perform the explicit evaluation of the contour integral for U(2) N = 2 * theory on P 2 for all instanton numbers. In the zero mass case, corresponding to the N = 4 supersymmetric gauge theory, we obtain the generating function of the Euler characteristics of instanton moduli spaces in terms of mock-modular forms. In the decoupling limit of infinite mass we find that the generating function of local and surface observables computes equivariant Donaldson invariants, thus proving in this case a longstanding conjecture by N. Nekrasov. In the case of vanishing first Chern class the resulting equivariant Donaldson polynomials are new.