A bottleneck in drug discovery is the identification of the molecular targets of a compound (mode of action, MoA) and of its off-target effects. Previous approaches to elucidate drug MoA include analysis of chemical structures, transcriptional responses following treatment, and text mining. Methods based on transcriptional responses require the least amount of information and can be quickly applied to new compounds. Available methods are inefficient and are not able to support network pharmacology. We developed an automatic and robust approach that exploits similarity in gene expression profiles following drug treatment, across multiple cell lines and dosages, to predict similarities in drug effect and MoA. We constructed a "drug network" of 1,302 nodes (drugs) and 41,047 edges (indicating similarities between pair of drugs). We applied network theory, partitioning drugs into groups of densely interconnected nodes (i.e., communities). These communities are significantly enriched for compounds with similar MoA, or acting on the same pathway, and can be used to identify the compoundtargeted biological pathways. New compounds can be integrated into the network to predict their therapeutic and off-target effects. Using this network, we correctly predicted the MoA for nine anticancer compounds, and we were able to discover an unreported effect for a well-known drug. We verified an unexpected similarity between cyclin-dependent kinase 2 inhibitors and Topoisomerase inhibitors. We discovered that Fasudil (a Rho-kinase inhibitor) might be "repositioned" as an enhancer of cellular autophagy, potentially applicable to several neurodegenerative disorders. Our approach was implemented in a tool (Mode of Action by NeTwoRk Analysis, MANTRA, http://mantra.tigem.it).computational drug discovery | drug repurposing | systems biology | chemotherapy