We describe the development of a miniaturized HPGe gamma-spectrometer for space applications. The spectrometer is designed around a 170 cm3 intrinsically pure n-type Ge crystal in the closed-end coaxial configuration cooled by a miniature Sterling cycle electric cooler. The complete assembly has a mass of 2.9 kg and consumes 6.6 W under normal operation. The spectrometer was tested in a specially designed chamber which simulates the space environment. FWHM energy resolutions of 2.9 keV and 4.0 keV were achieved at 122 keV and 1332 keV, respectively. With the cooler switched-off, these improved to 2.0 keV and 3.0 keV, respectively, indicating that induced noise from the mechanical vibrations of the cooler accounts for about half the resolution.