Understanding the ecological origin of snakes has remained a century-old challenge1,2, hindered by an extremely sparse early fossil record and conflicting interpretations of fossil ecologies. Here we describe an exceptionally preserved Cretaceous fossil snake, Tametara mirim gen. et sp. nov., from Brazil, representing one of the earliest-diverging stem snakes. High-resolution micro-CT scans reveal unprecedented details of cranial nerves, inner ear and brain anatomy, enabling the most integrated reconstruction of stem snake neuroanatomy to date. Quantitative and qualitative endocast analyses demonstrate that Tametara had a brain morphology distinct from both other stem and extant snakes, revealing substantial early neuroanatomical disparity—and probably sensory functions—in snake evolution. Independent evidence from telencephalon shape and bone microstructure converges on a fossorial lifestyle for Tametara and non-fossorial for another stem snake: Dinilysia. These results indicate that major ecological transitions occurred early in snake evolution, and that known stem species do not represent the ancestral condition of crown snakes. Early snake evolution thus involved complex shifts in habitat use and sensory ecology, revealing greater ecological and neuroanatomical diversity than previously thought. A well-preserved fossil snake from the Late Cretaceous of Brazil shows early ecological and brain shape disparity in the group. Micro-CT scanning and digital reconstruction of T. mirim The holotype MPM 420 of T. mirim was scanned in the Laboratório de Caracterização Tecnológica of the Escola Politécnica at the University of São Paulo using a Zeiss Xradia Versa XRM-510 Scanner... [26965 chars]