To determine whether and how laboratory and natural selection act on the hsp70 (70-Kd heat-shock protein) genes of Drosophila melanogaster, we examined hsp70 allele frequencies in two sets of populations. First, five populations reared at different temperatures for more than 20 years differentially fixed both a large insertion/deletion (indel) polymorphism at the 87A7 hsp70 cluster ("56H8"/"122") and a single nucleotide polymorphism at the 87C1 hsp70 cluster. In both cases, the 18 degrees C and 25 degrees C populations fixed one allele and the 28 degrees C populations the other, consistent with previously described evolved differences among these populations in Hsp70 expression and thermotolerance. Second, we examined 56H8 and 122 frequencies in a set of 11 populations founded from flies collected along a latitudinal transect of eastern Australia. The 56H8 allele frequencies are positively associated with latitude, consistent with maintenance of the 56H8/122 polymorphism by natural selection. Thermal extremes and average values are negatively correlated with latitude. These results suggest that natural selection imposed by temperature and thermal variability may affect hsp70 allele frequencies.