This research provides an ancient analogue for biologically mediated dolomite precipitation in microbial mats and biofilms, and describes the involvement of highly structured extracellular polymeric secretion (EPS) templates in dolomite nucleation. The structure of EPS is shown to match the hexagonal–trigonal lattice geometry of dolomite, which favoured the epitaxial crystallization of dolomite on the organic substrate. This structure of EPS also matches the arrangement of silica nanospheres in opal, which further accounts for the organically-templated formation of opal enabling the non-replacive co-existence of dolomite and silica. The study is focused on a 50 m thick dolomite succession that is exposed in central areas of the Tertiary Duero Basin and was deposited in a mudflat-saline lake sedimentary complex during the Middle to Late Miocene (9 to 15 Ma). In the intermediate intervals of the succession, poorly indurated dolomite beds pass gradually into silica beds. On the basis of sedimentological, compositional, geochemical and petrographic data, silica and dolomite beds have been interpreted as mineralized microbial mats. The silica beds formed in marginal areas of the lake in response to intense evaporative concentrations; this resulted in the rapid and early precipitation of opal. Silicification accounted for the exceptional preservation of the microbial mat structure, including biofilms, filamentous and coccoid microbes, and EPS. Extracellular polymeric secretions have a layered structure, each layer being composed of fibres which are arranged in accordance with a reticular pattern, with frequent intersection angles at 120° and 60°. Therefore, the structure of EPS matches the lattice geometry of dolomite and the arrangement of silica nanospheres in opal. Additionally, EPS binds different elements, with preference to Si and Mg. The concurrence of suitable composition and surface lattice morphologies in the EPS favoured the crystallization of dolomite on the substrate. In some cases, dolomite nucleation took place epicellularly on coccoid micro-organisms, which gave way to spheroid crystals. Organic surfaces enable the inorganic mineral precipitation by lowering the free energy barrier to nucleation. Most of the microbial mats probably developed on the lake floor, under sub-aqueous conditions, where the decomposition of organic matter took place. The subsequent formation of openly packed dolomite crystals, with inter-related Si-enriched fibrils throughout, is evidence for the pre-existence of fibrillar structures in the mats. Miocene dolomite crystals are poorly ordered and non-stoichiometric, with a slight Ca-excess (up to 5%), which is indicative of the low diagenetic potential the microbial dolomite has towards a more ordered and stoichiometric structure; this confirms that microbial imprints can be preserved in the geological record, and validates their use as biosignatures.