The endangered twoline skiffia Neotoca bilineata, a viviparous fish of the subfamily Goodeinae, endemic to central Mexico (inhabiting two basins, Cuitzeo and Lerma-Santiago) was evaluated using genetic and habitat information. The genetic variation of all remaining populations of the species was analysed using both mitochondrial and microsatellite markers and their habitat conditions were assessed using a water quality index (IWQ). An 80% local extinction was found across the distribution of N. bilineata. The species was found in three of the 16 historical localities plus one previously unreported site. Most areas inhabited by the remaining populations had IWQ scores unsuitable for the conservation of freshwater biodiversity. Populations showed low but significant genetic differentiation with both markers (mtDNA φST = 0·076, P < 0·001; microsatellite FST = 0·314, P < 0·001). Borbollon, in the Cuitzeo Basin, showed the highest level of differentiation and was identified as a single genetic unit by Bayesian assignment methods. Rio Grande de Morelia and Salamanca populations showed the highest genetic diversity and also a high migration rate facilitated by an artificial channel that connected the two basins. Overall, high genetic diversity values were observed compared with other freshwater fishes (average Na = 16 alleles and loci and mean ±s.d. Ho = 0·63 ± 0·10 and nucleotide diversity π = 0·006). This suggests that the observed genetic diversity has not diminished as rapidly as the species' habitat destruction. No evidence of correlation between habitat conditions and genetic diversity was found. The current pattern of genetic diversity may be the result of both historical factors and recent modifications of the hydrological system. The main threat to the species may be the rapid habitat deterioration and associated demographic stochasticity rather than genetic factors.