The adsorption of nucleic acids to mineral matrixes can result in low extraction yields and negatively influences molecular microbial ecology studies, in particular for low-biomass environments on Earth and Mars. We determined the recovery of nucleic acids from a range of minerals relevant to Earth and Mars. Clay minerals, but also other silicates and nonsilicates, showed very low recovery (< 1%). Consequently, optimization of DNA extraction was directed towards clays. The high temperatures and acidic conditions used in some methods to dissolve mineral matrices proved to destruct DNA. The most efficient method comprised a high phosphate solution (P/EtOH; 1 M phosphate, 15% ethanol buffer at pH 8) introduced at the cell-lysing step in DNA extraction, to promote chemical competition with DNA for adsorption sites. This solution increased DNA yield from clay samples spiked with known quantities of cells up to nearly 100-fold. DNA recovery was also enhanced from several mineral samples retrieved from an aquifer, while maintaining reproducible DGGE profiles. DGGE profiles were obtained for a clay sample for which no profile could be generated with the standard DNA isolation protocol. Mineralogy influenced microbial community composition. The method also proved suitable for the recovery of low molecular weight DNA (< 1.5 kb). © 2012 Federation of European Microbiological Societies. Published by Blackwell Publishing Ltd. All rights reserved.