Terrestrial and sub-Neptune planets are expected to form in the inner (less than 10 au) regions of protoplanetary disks1. Water plays a key role in their formation2–4, although it is yet unclear whether water molecules are formed in situ or transported from the outer disk5,6. So far Spitzer Space Telescope observations have only provided water luminosity upper limits for dust-depleted inner disks7, similar to PDS 70, the first system with direct confirmation of protoplanet presence8,9. Here we report JWST observations of PDS 70, a benchmark target to search for water in a disk hosting a large (approximately 54 au) planet-carved gap separating an inner and outer disk10,11. Our findings show water in the inner disk of PDS 70. This implies that potential terrestrial planets forming therein have access to a water reservoir. The column densities of water vapour suggest in-situ formation via a reaction sequence involving O, H2 and/or OH, and survival through water self-shielding5. This is also supported by the presence of CO2 emission, another molecule sensitive to ultraviolet photodissociation. Dust shielding, and replenishment of both gas and small dust from the outer disk, may also play a role in sustaining the water reservoir12. Our observations also reveal a strong variability of the mid-infrared spectral energy distribution, pointing to a change of inner disk geometry. Observations with the sensitive mid-infrared spectrometer MIRI on board JWST reveal the presence of a water vapour reservoir in the terrestrial plant-forming zone of the young planetary system PDS 70.