Much of the world’s known gold has been derived from arrays of quartz veins. The veins formed during periods of mountain building that occurred as long as 3 billion years ago1, 2, 3, and were deposited by very large volumes of water that flowed along deep, seismically active faults. The veins formed under fluctuating pressures4, 5 during earthquakes6, but the magnitude of the pressure fluctuations and their influence on mineral deposition is not known. Here we use a simple thermo-mechanical piston model to calculate the drop in fluid pressure experienced by a fluid-filled fault cavity during an earthquake. The geometry of the model is constrained using measurements of typical fault jogs, such as those preserved in the Revenge gold deposit in Western Australia7, and other gold deposits around the world. We find that cavity expansion generates extreme reductions in pressure that cause the fluid that is trapped in the jog to expand to a very low-density vapour. Such flash vaporization of the fluid results in the rapid co-deposition of silica with a range of trace elements to form gold-enriched quartz veins. Flash vaporization continues as more fluid flows towards the newly expanded cavity, until the pressure in the cavity eventually recovers to ambient conditions. Multiple earthquakes progressively build economic-grade gold deposits.