We have developed a statistical mechanics algorithm, TANGO, to predict protein aggregation. TANGO is based on the physico-chemical principles of beta-sheet formation, extended by the assumption that the core regions of an aggregate are fully buried. Our algorithm accurately predicts the aggregation of a data set of 179 peptides compiled from the literature as well as of a new set of 71 peptides derived from human disease-related proteins, including prion protein, lysozyme and beta2-microglobulin. TANGO also correctly predicts pathogenic as well as protective mutations of the Alzheimer beta-peptide, human lysozyme and transthyretin, and discriminates between beta-sheet propensity and aggregation. Our results confirm the model of intermolecular beta-sheet formation as a widespread underlying mechanism of protein aggregation. Furthermore, the algorithm opens the door to a fully automated, sequence-based design strategy to improve the aggregation properties of proteins of scientific or industrial interest.