Planet formation is thought to occur in discs around young stars by the aggregation of small dust grains into much larger objects. The growth from grains to pebbles and from planetesimals to planets is now fairly well understood. The intermediate stage has however been found to be hindered by the radial-drift and fragmentation barriers. We identify a powerful mechanism in which dust overcomes both barriers. Its key ingredients are i) backreaction from the dust onto the gas, ii) grain growth and fragmentation, and iii) large-scale gradients. The pile-up of growing and fragmenting grains modifies the gas structure on large scales and triggers the formation of pressure maxima, in which particles are trapped. We show that these self-induced dust traps are robust: they develop for a wide range of disc structures, fragmentation thresholds and initial dust-to-gas ratios. They are favored locations for pebbles to grow into planetesimals, thus opening new paths towards the formation of planets.