Metal halide perovskites of the general formula ABX(3)-where A is a monovalent cation such as caesium, methylammonium or formamidinium; B is divalent lead, tin or germanium; and X is a halide anion-have shown great potential as light harvesters for thin-film photovoltaics(1-5). Among a large number of compositions investigated, the cubic alpha-phase of formamidinium lead triiodide (FAPbI(3)) has emerged as the most promising semiconductor for highly efficient and stable perovskite solar cells(6-9), and maximizing the performance of this material in such devices is of vital importance for the perovskite research community. Here we introduce an anion engineering concept that uses the pseudo-halide anion formate (HCOO-) to suppress anion-vacancy defects that are present at grain boundaries and at the surface of the perovskite films and to augment the crystallinity of the films. The resulting solar cell devices attain a power conversion efficiency of 25.6 per cent (certified 25.2 per cent), have long-term operational stability (450 hours) and show intense electroluminescence with external quantum efficiencies of more than 10 per cent. Our findings provide a direct route to eliminate the most abundant and deleterious lattice defects present in metal halide perovskites, providing a facile access to solution-processable films with improved optoelectronic performance.