In the past decade, the characterization of non-small-cell lung cancer (NSCLC) into subtypes based on genotype and histology has resulted in dramatic improvements in disease outcome in select patient subgroups. In particular, molecularly targeted agents that inhibit EGFR or ALK are approved for the treatment of NSCLC harbouring genetic alterations in the genes encoding these proteins. Although acquired resistance usually limits the duration of response to these therapies, a number of new agents have proven effective at tackling specific resistance mechanisms to first-generation inhibitors. Large initiatives are starting to address the role of biomarker-driven targeted therapy in squamous lung cancers, and in the adjuvant setting. Immunotherapy undeniably holds great promise and our understanding of subsets of NSCLC based on patterns of immune response is continuing to evolve. In addition, efforts are underway to identify rare genomic subsets through genomic screening, functional studies, and molecular characterization of exceptional responders. This Review provides an overview of the key developments in the treatment of NSCLC, and discusses potential strategies to further optimize therapy by targeting disease subtypes.