The JWST NIRSpec integral field unit (IFU) presents a unique opportunity to observe directly imaged exoplanets from 3 to 5 μm at moderate spectral resolution (R ∼ 2700) and thereby better constrain the composition, disequilibrium chemistry, and cloud properties of their atmospheres. In this work, we present the first NIRSpec IFU high-contrast observations of a substellar companion that requires starlight suppression techniques. We develop specific data-reduction strategies to study faint companions around bright stars and assess the performance of NIRSpec at high contrast. First, we demonstrate an approach to forward model the companion signal and the starlight directly in the detector images, which mitigates the effects of NIRSpec's spatial undersampling. We demonstrate a sensitivity to planets that are 3 × 10−6 fainter than their stars at 1'', or 3 × 10−5 at 03. Then, we implement a reference star point-spread function subtraction and a spectral extraction that does not require spatially and spectrally regularly sampled spectral cubes. This allows us to extract a moderate resolution (R ∼ 2,700) spectrum of the faint T dwarf companion HD 19467 B from 2.9 to 5.2 μm with a signal-to-noise ratio of ∼10 per resolution element. Across this wavelength range, HD 19467 B has a flux ratio varying between 10−5 and 10−4 and a separation relative to its star of 16. A companion paper by Hoch et al. more deeply analyzes the atmospheric properties of this companion based on the extracted spectrum. Using the methods developed here, NIRSpec's sensitivity may enable direct detection and spectral characterization of relatively old (∼1 Gyr), cool (∼250 K), and closely separated (∼3–5 au) exoplanets that are less massive than Jupiter.