Modern squamates (lizards, snakes and amphisbaenians) are the world’s most diverse group of tetrapods along with birds1 and have a long evolutionary history, with the oldest known fossils dating from the Middle Jurassic period—168 million years ago2,3,4. The evolutionary origin of squamates is contentious because of several issues: (1) a fossil gap of approximately 70 million years exists between the oldest known fossils and their estimated origin5,6,7; (2) limited sampling of squamates in reptile phylogenies; and (3) conflicts between morphological and molecular hypotheses regarding the origin of crown squamates6,8,9. Here we shed light on these problems by using high-resolution microfocus X-ray computed tomography data from the articulated fossil reptile Megachirella wachtleri (Middle Triassic period, Italian Alps10). We also present a phylogenetic dataset, combining fossils and extant taxa, and morphological and molecular data. We analysed this dataset under different optimality criteria to assess diapsid reptile relationships and the origins of squamates. Our results re-shape the diapsid phylogeny and present evidence that M. wachtleri is the oldest known stem squamate. Megachirella is 75 million years older than the previously known oldest squamate fossils, partially filling the fossil gap in the origin of lizards, and indicates a more gradual acquisition of squamatan features in diapsid evolution than previously thought. For the first time, to our knowledge, morphological and molecular data are in agreement regarding early squamate evolution, with geckoes—and not iguanians—as the earliest crown clade squamates. Divergence time estimates using relaxed combined morphological and molecular clocks show that lepidosaurs and most other diapsids originated before the Permian/Triassic extinction event, indicating that the Triassic was a period of radiation, not origin, for several diapsid lineages.