Porphyry deposits, our main source of copper and of significant amounts of Mo, Re and Au, form at convergent margins in association with intermediate-felsic magmas. Although it is accepted that copper is transported and precipitated by fluids released by these magmas, the magmatic processes leading to the formation of economic deposits remain elusive. Here we perform Monte Carlo petrological and geochemical modelling to quantitatively link crustal magmatic processes and the geochemical signatures of magmas (i.e., Sr/Y) to the formation of porphyry Cu deposits of different sizes. Our analysis shows that economic deposits (particularly the largest ones) may only form in association with magma accumulated in the lower-middle crust (P > ~0.5 GPa) during ≥2–3 Ma, and subsequently transferred to and degassed in the upper crust over periods of up to ~2.0 Ma. Magma accumulation and evolution at shallower depths (<~0.4 GPa) dramatically reduces the potential of magmatic systems to produce economic deposits. Our modelling also predicts the association of the largest porphyry deposits with a specific Sr/Y interval (~100 ± 50) of the associated magmatic rocks, which is virtually identical to the range measured in giant porphyry copper deposits.