The origin of motility in bilaterian animals represents an evolutionary innovation that transformed the Earth system. This innovation probably occurred in the late Ediacaran period—as evidenced by an abundance of trace fossils (ichnofossils) dating to this time, which include trails, trackways and burrows1,2,3. However, with few exceptions4,5,6,7,8, the producers of most of the late Ediacaran ichnofossils are unknown, which has resulted in a disconnection between the body- and trace-fossil records. Here we describe the fossil of a bilaterian of the terminal Ediacaran period (dating to 551–539 million years ago), which we name Yilingia spiciformis (gen. et sp. nov). This body fossil is preserved along with the trail that the animal produced during a death march. Yilingia is an elongate and segmented bilaterian with repetitive and trilobate body units, each of which consists of a central lobe and two posteriorly pointing lateral lobes, indicating body and segment polarity. Yilingia is possibly related to panarthropods or annelids, and sheds light on the origin of segmentation in bilaterians. As one of the few Ediacaran animals demonstrated to have produced long and continuous trails, Yilingia provides insights into the identity of the animals that were responsible for Ediacaran trace fossils.