Following the approach of Lev Landau and Evgenii Lifshitz, this book introduces the theory of special and general relativity with the Lagrangian formalism and the principle of least action. This method allows the complete theory to be constructed starting from a small number of assumptions, and is the most natural approach in modern theoretical physics. The book begins by reviewing Newtonian mechanics and Newtonian gravity with the Lagrangian formalism and the principle of least action, and then moves to special and general relativity. Most calculations are presented step by step, as is done on the board in class. The book covers recent advances in gravitational wave astronomy and provides a general overview of current lines of research in gravity. It also includes numerous examples and problems in each chapter.