The geometry of faults is usually thought to be more complicated at the surface than at depth and to control the initiation, propagation and arrest of seismic ruptures1,2,3,4,5,6. The fault system that runs from southern California into Mexico is a simple strike-slip boundary: the west side of California and Mexico moves northwards with respect to the east. However, the Mw 7.2 2010 El Mayor–Cucapah earthquake on this fault system produced a pattern of seismic waves that indicates a far more complex source than slip on a planar strike-slip fault7. Here we use geodetic, remote-sensing and seismological data to reconstruct the fault geometry and history of slip during this earthquake. We find that the earthquake produced a straight 120-km-long fault trace that cut through the Cucapah mountain range and across the Colorado River delta. However, at depth, the fault is made up of two different segments connected by a small extensional fault. Both segments strike N130° E, but dip in opposite directions. The earthquake was initiated on the connecting extensional fault and 15 s later ruptured the two main segments with dominantly strike-slip motion. We show that complexities in the fault geometry at depth explain well the complex pattern of radiated seismic waves. We conclude that the location and detailed characteristics of the earthquake could not have been anticipated on the basis of observations of surface geology alone.