This textbook is addressed to PhD or senior undergraduate students in mathematics, with interests in analysis, calculus of variations, probability and optimal transport. It originated from the teaching experience of the first author in the Scuola Normale Superiore, where a course on optimal transport and its applications has been given many times during the last 20 years. The topics and the tools were chosen at a sufficiently general and advanced level so that the student or scholar interested in a more specific theme would gain from the book the necessary background to explore it. After a large and detailed introduction to classical theory, more specific attention is devoted to applications to geometric and functional inequalities and to partial differential equations.