Long-duration γ-ray bursts (GRBs) are associated with type Ic supernovae that are more luminous than average and that eject material at very high velocities. Less-luminous supernovae were not hitherto known to be associated with GRBs, and therefore GRB-supernovae were thought to be rare events. Whether X-ray flashes-analogues of GRBs, but with lower luminosities and fewer γ-rays-can also be associated with supernovae, and whether they are intrinsically 'weak' events or typical GRBs viewed off the axis of the burst, is unclear. Here we report the optical discovery and follow-up observations of the type Ic supernova SN 2006aj associated with X-ray flash XRF 060218. Supernova 2006aj is intrinsically less luminous than the GRB-supernovae, but more luminous than many supernovae not accompanied by a GRB. The ejecta velocities derived from our spectra are intermediate between these two groups, which is consistent with the weakness of both the GRB output and the supernova radio flux. Our data, combined with radio and X-ray observations, suggest that XRF 060218 is an intrinsically weak and soft event, rather than a classical GRB observed off-axis. This extends the GRB-supernova connection to X-ray flashes and fainter supernovae, implying a common origin. Events such as XRF 060218 are probably more numerous than GRB-supernovae.