Magnetic fields are proposed to have played a critical role in some of the most enigmatic processes of planetary formation by mediating the rapid accretion of disk material onto the central star and the formation of the first solids. However, there have been no experimental constraints on the intensity of these fields. Here we show that dusty olivine-bearing chondrules from the Semarkona meteorite were magnetized in a nebular field of 54 ± 21 microteslas. This intensity supports chondrule formation by nebular shocks or planetesimal collisions rather than by electric currents, the x-wind, or other mechanisms near the Sun. This implies that background magnetic fields in the terrestrial planet-forming region were likely 5 to 54 microteslas, which is sufficient to account for measured rates of mass and angular momentum transport in protoplanetary disks.