A critical step toward the emergence of planets in a protoplanetary disk is the accretion of planetesimals, bodies 1-1,000 km in size, from smaller disk constituents. This process is poorly understood, partly because we lack good observational constraints on the complex physical processes that contribute to planetesimal formation1. In the outer Solar System, the best place to look for clues is the Kuiper belt, where icy planetesimals survive to this day. Here we report evidence that Kuiper belt planetesimals formed by the streaming instability, a process in which aerodynamically concentrated clumps of pebbles gravitationally collapse into 100-kilometre-class bodies2. Gravitational collapse has previously been suggested to explain the ubiquity of equal-sized binaries in the Kuiper belt3-5. We analyse new hydrodynamical simulations of the streaming instability to determine the model expectations for the spatial orientation of binary orbits. The predicted broad inclination distribution with approximately 80% of prograde binary orbits matches the observations of trans-Neptunian binaries6. The formation models that imply predominantly retrograde binary orbits (for example, ref. 7) can be ruled out. Given its applicability over a wide range of protoplanetary disk conditions8, it is expected that the streaming instability also seeded planetesimal formation elsewhere in the Solar System, and beyond.