Certain images arising in astrophysics and medicine are modelled as smooth random fields inside a fixed region, and experimenters are interested in the number of ‘peaks', or more generally, the topological structure of ‘hot-spots' present in such an image. This paper studies the Euler characteristic of the excursion set of a random field; the excursion set is the set of points where the image exceeds a fixed threshold, and the Euler characteristic counts the number of connected components in the excursion set minus the number of ‘holes'. For high thresholds the Euler characteristic is a measure of the number of peaks. The geometry of excursion sets has been studied by Adler (1981) who gives the expectation of two excursion set characteristics, called the DT (differential topology) and IG (integral geometry) characteristics, which equal the Euler characteristic provided the excursion set does not touch the boundary of the region. Worsley (1995) finds a boundary correction which gives the expectation of the Euler characteristic itself in two and three dimensions. The proof uses a representation of the Euler characteristic given by Hadwiger (1959). The purpose of this paper is to give a general result for any number of dimensions. The proof takes a different approach and uses a representation from Morse theory. Results are applied to the recently discovered anomalies in the cosmic microwave background radiation, thought to be the remnants of the creation of the universe.