Subduction zones can exhibit variable seismic behaviour, ranging from great earthquakes to slow slip. This variability may be linked to fault frictional properties, and the rheology and structure of the upper plate. The subduction zone beneath the Nicoya Peninsula, Costa Rica, is characterized by strong variations in fault-slip behaviour and a lateral change in the origin of the subducting plate. In the northwest, the plate interface is locked, and experiences large, infrequent earthquakes, and the subducting plate is formed at the East Pacific Rise. In contrast, in the southeast, slow-slip events occur frequently and the subducting plate is formed at the Cocos–Nazca spreading centre. Here we use seismic receiver-function data to analyse the structure of the subduction zone beneath the Nicoya Peninsula. We find extremely high P–S seismic-velocity ratios within the entire subducting oceanic crust that we interpret as high pore-fluid pressure. Velocity ratios in the overriding continental crust, however, change from lower values in the northwest to higher ones in the southeast, indicating a disparity in fluid accumulation. We infer that this disparity is caused by a higher supply of fluid from the subducting slab in the southeast, owing to the permeability structure of oceanic crust formed at the Cocos–Nazca spreading centre. We suggest that the spatial gradient in fluid content influences upper-plate strength and controls the segmentation of seismogenic behaviour in this subduction zone.