A Time-of-Flight mass spectrometer (TOF-MS) for lunar water detection is developed concerning miniaturization design. A compact closed ion source is adopted, and the mass analyzer is further optimized based on numerical simulation. The electronic unit is designed to be compatible with miniaturization design. The performance of the developed prototype is evaluated extensively on the ultrahigh vacuum and extremely high vacuum (UHV/XHV) partial pressure calibration system. The results show that the resolution of the prototype of TOF-MS is 246 for H2O, mass range covers 1–500 amu, detect limit is as low as 1 ppm, dynamic range is larger than 104. The overall size of this spectrometer is 220mm × 220mm × 150 mm. The weight of the instrument is less than 5 kg, and the power consumption is less than 35W. This mass spectrometer can meet the needs of lunar water exploration.