Hotspots are anomalous regions of volcanism at Earth's surface that show no obvious association with tectonic plate boundaries. Classic examples include the Hawaiian-Emperor chain and the Yellowstone-Snake River Plain province. The majority are believed to form as Earth's tectonic plates move over long-lived mantle plumes: buoyant upwellings that bring hot material from Earth's deep mantle to its surface. It has long been recognized that lithospheric thickness limits the rise height of plumes and, thereby, their minimum melting pressure. It should, therefore, have a controlling influence on the geochemistry of plume-related magmas, although unambiguous evidence of this has, so far, been lacking. Here we integrate observational constraints from surface geology, geochronology, plate-motion reconstructions, geochemistry and seismology to ascertain plume melting depths beneath Earth's longest continental hotspot track, a 2,000-kilometre-long track in eastern Australia that displays a record of volcanic activity between 33 and 9 million years ago, which we call the Cosgrove track. Our analyses highlight a strong correlation between lithospheric thickness and magma composition along this track, with: (1) standard basaltic compositions in regions where lithospheric thickness is less than 110 kilometres; (2) volcanic gaps in regions where lithospheric thickness exceeds 150 kilometres; and (3) low-volume, leucitite-bearing volcanism in regions of intermediate lithospheric thickness. Trace-element concentrations from samples along this track support the notion that these compositional variations result from different degrees of partial melting, which is controlled by the thickness of overlying lithosphere. Our results place the first observational constraints on the sub-continental melting depth of mantle plumes and provide direct evidence that lithospheric thickness has a dominant influence on the volume and chemical composition of plume-derived magmas.