Spectrophotometric stability, which is crucial in the spectral characterization of transiting exoplanets, is affected by photometric variations arising from field-stop loss in space telescopes with pointing jitter or primary mirror deformation. This paper focuses on a new method for removing slit-loss or field-stop-loss photometric variation through the use of a pupil mask. Two types of pupil function are introduced: the first uses conventional (e.g., Gaussian or hyper-Gaussian) apodizing patterns; whereas the second, which we call a block-shaped mask, employs a new type of pupil mask designed for high photometric stability. A methodology for the optimization of a pupil mask for transit observations is also developed. The block-shaped mask can achieve a photometric stability of $10^{-5}$ for a nearly arbitrary field-stop radius when the pointing jitter is smaller than approximately $0.7 lambda/D $ and a photometric stability of $10^{-6}$ at a pointing jitter smaller than approximately $0.5 lambda/D $. The impact of optical aberrations and mask imperfections upon mask performance is also discussed.