Bilateria are subdivided into Protostomia and Deuterostomia. Indirect development through primary, ciliary larvae occurs in both of these branches; however, the closing blastopore develops into mouth and anus in Protostomia and into anus only in Deuterostomia. Because of this important difference in larval gut ontogeny, the tube-shaped guts in protostome and deuterostome primary larvae are thought to have evolved independently. To test this hypothesis, we have analysed the expression of brachyury, otx and goosecoid homologues in the polychaete Platynereis dumerilii, which develops by means of a trochophora larva-the primary, ciliary larva prototypic for Protostomia. Here we show that brachyury expression in the ventral portion of the developing foregut in Platynereis and also otx expression along ciliated bands in the mouth region of the trochophora larva parallels expression in primary larvae in Deuterostomia. In addition, goosecoid expression in the foregut of Platynereis mirrors the function in higher Deuterostomia. We present molecular evidence for the evolutionary conservation of larval foreguts and mouth regions of Protostomia and Deuterostomia. Our data indicate that Urbilateria, the common bilaterian ancestors, developed through a primary, ciliary larva that already possessed a tripartite tube-shaped gut.