Superconductivity is a unique manifestation of quantum mechanics on a macroscopic scale, and one of the rare examples of many-body phenomena that can be explained by predictive, quantitative theories. The superconducting ground state is described as a condensate of Cooper pairs, and a major challenge has been to understand which mechanisms could lead to a bound state between two electrons, despite the large Coulomb repulsion. An even bigger challenge is to identify experimentally this pairing mechanism, notably in unconventional superconductors dominated by strong electronic correlations, like in high-Tc cuprates, iron pnictides or heavy-fermion compounds. Here we show that in the ferromagnetic superconductor UCoGe, the field dependence of the pairing strength influences dramatically its macroscopic properties like the superconducting upper critical field, in a way that can be quantitatively understood. This provides a simple demonstration of the dominant role of ferromagnetic spin fluctuations in the pairing mechanism.