Microbes produce a huge array of secondary metabolites endowed with important ecological functions. These molecules, which can be catalogued as natural products, have long been exploited in medical fields as antibiotics, anticancer and anti-infective agents. Recent years have seen considerable advances in elucidating natural-product biosynthesis and many drugs used today are natural products or natural-product derivatives. The major contribution to recent knowledge came from application of genomics to secondary metabolism and was facilitated by all relevant genes being organised in a contiguous DNA segment known as gene cluster. Clustering of genes regulating biosynthesis in bacteria is virtually universal. Modular gene clusters can be mixed and matched during evolution to generate structural diversity in natural products. Biosynthesis of many natural products requires the participation of complex molecular machines known as polyketide synthases and non-ribosomal peptide synthetases. Discovery of new evolutionary links between the polyketide synthase and fatty acid synthase pathways may help to understand the selective advantages that led to evolution of secondary-metabolite biosynthesis within bacteria. Secondary metabolites confer selective advantages, either as antibiotics or by providing a chemical language that allows communication among species, with other organisms and their environment. Herewith, we discuss these aspects focusing on the most clinically relevant bioactive molecules, the thiotemplated modular systems that include polyketide synthases, non-ribosomal peptide synthetases and fatty acid synthases. We begin by describing the evolutionary and physiological role of marine natural products, their structural/functional features, mechanisms of action and biosynthesis, then turn to genomic and metagenomic approaches, highlighting how the growing body of information on microbial natural products can be used to address fundamental problems in environmental evolution and biotechnology.