In this paper we show how to associate to any real projective algebraic variety Z ⊂ RPn−1 a real polynomial F1:Rn,0 → R, 0 with an algebraically isolated singularity, having the property that χ(Z) = ½(1 − deg (grad F1), where deg (grad F1 is the local real degree of the gradient grad F1:Rn, 0 → Rn, 0. This degree can be computed algebraically by the method of Eisenbud and Levine, and Khimshiashvili . The variety Z need not be smooth. This leads to an expression for the Euler characteristic of any compact algebraic subset of Rn, and the link of a quasihomogeneous mapping f: Rn, 0 → Rn, 0 again in terms of the local degree of a gradient with algebraically isolated singularity. Similar expressions for the Euler characteristic of an arbitrary algebraic subset of Rn and the link of any polynomial map are given in terms of the degrees of algebraically finite gradient maps. These maps do involve ‘sufficiently small’ constants, but the degrees involved ar (theoretically, at least) algebraically computable.