We define the cotangent complex of a morphism f:X→Y of locally noetherian formal schemes as an object in the derived category D−(X) through local homology. We discuss its basic properties and establish the basics results of a deformation theory, providing a characterization of smooth and étale morphisms. This leads to simpler lifting results depending on a differential module, for a class of non-smooth morphism of usual schemes. We also give descriptions of the cotangent complex in the case of regular closed immersions and complete intersection morphisms of formal schemes.