In 1859, in A Contribution to the Critique of Political Economy, Karl Marx laid out the fundamental idea of historical materialism.
I was led by my studies to the conclusion that legal relations as well as forms of state could neither be understood by themselves, nor explained by the so-called general progress of the human mind, but that they are rooted in the material conditions of life, which are summed up by Hegel after the fashion of the English and French of the eighteenth century under the name “civic society;” the anatomy of that civic society is to be sought in political economy. The study of the latter which I had taken up in Paris, I continued at Brussels whither I emigrated on account of an order of expulsion issued by Mr. Guizot.
The general conclusion at which I arrived and which, once reached, continued to serve as the leading thread in my studies, may be briefly summed up as follows: In the social production which men carry on they enter into definite relations that are indispensable and independent of their will; these relations of production correspond to a definite stage of development of their material powers of production. The sum total of these relations of production constitutes the economic structure of society—the real foundation, on which rise legal and political superstructures and to which correspond definite forms of social consciousness.
The mode of production in material life determines the general character of the social, political and spiritual processes of life. It is not the consciousness of men that determines their existence, but, on the contrary, their social existence determines their consciousness. At a certain stage of their development, the material forces of production in society come in conflict with the existing relations of production, or—what is but a legal expression for the same thing—with the property relations within which they had been at work before. From forms of development of the forces of production these relations turn into their fetters.
Then comes the period of social revolution. With the change of the economic foundation the entire immense superstructure is more or less rapidly transformed. In considering such transformations the distinction should always be made between the material transformation of the economic conditions of production which can be determined with the precision of natural science, and the legal, political, religious, aesthetic or philosophic—in short ideological forms in which men become conscious of this conflict and fight it out.
Just as our opinion of an individual is not based on what he thinks of himself, so can we not judge of such a period of transformation by its own consciousness; on the contrary, this consciousness must rather be explained from the contradictions of material life, from the existing conflict between the social forces of production and the relations of production.
No social order ever disappears before all the productive forces, for which there is room in it, have been developed; and new higher relations of production never appear before the material conditions of their existence have matured in the womb of the old society….
The full text can be found at marxists.org.