The aim of this book is to introduce and develop an arithmetic analogue of classical differential geometry. In this new geometry the ring of integers plays the role of a ring of functions on an infinite dimensional manifold. The role of coordinate functions on this manifold is played by the prime numbers. The role of partial derivatives of functions with respect to the coordinates is played by the Fermat quotients of integers with respect to the primes. The role of metrics is played by symmetric matrices with integer coefficients. The role of connections (respectively curvature) attached to metrics is played by certain adelic (respectively global) objects attached to the corresponding matrices. One of the main conclusions of the theory is that the spectrum of the integers is "intrinsically curved"; the study of this curvature is then the main task of the theory. The book follows, and builds upon, a series of recent research papers. A significant part of the material has never been published before.