The Messinian (Late Miocene) marine stratigraphic record of the Sorbas Basin (S.E. Spain) is well preserved and can be considered as being representative of the entire western Mediterranean. It exhibits a series of features relating to: (1) the composition, characteristics and evolution of coral reefs; (2) changes between temperate and subtropical climates; and (3) the extensive development of microbial carbonates (stromatolites and thrombolites) at the end of the Messinian. Each of these features has global significance. Porites, which is the major and almost only coral component in reefs, is heavily encrusted with stromatolites. These reefs grew at the edge of the subtropical belt and were totally eliminated at the end of the Messinian because of global cooling. Lowermost-Messinian carbonate sediments in the Sorbas Basin reflect a temperate climate, whereas those immediately above, which contain bioherms and coastal reefs, are subtropical. The shift from temperate to subtropical conditions during the early Messinian was accompanied by an important change in water circulation within the western Mediterranean. Temperate times were marked by cold surface Atlantic waters entering the Mediterranean, whereas subtropical times coincided with warm surface waters entering the western Mediterranean from the east. The subtropical waters were thermally stratified, which favoured the deposition of euxinic marls and diatomites at the centre of the basin. The upwelling of nutrient-rich water promoted stromatolite development within reefs and Halimeda growth on adjacent slopes. Lastly, microbial carbonates (stromatolites and thrombolites) attained giant dimensions during the late Messinian, which can be regarded as a measure of their success in occupying a variety of ecological niches. This abundance of available habitats is believed to have resulted from the Messinian ''salinity crisis'', which was followed by a re-colonization of the western Mediterranean. In this context stromatolite proliferation was due to opportunism of microbial communities in colonizing the new environments, rather than to a complete absence of other competitive biota. We do not believe that hypersaline conditions were a causal factor in stromatolite development because of the normal-marine biota associated with them.