A method for preserving foodstuffs, in which the foodstuffs are heated in the moist state in a container suitable for transport and storage with ventilation openings. The foodstuffs are heated for a defined period by a microwave, for at least such a time as hot steam forms in the container and exits through the ventilation openings. Gas is injected into the container after the heating process for at least partial compensation of the pressure drop in the container.