This article contains a brief overview of the European and Spanish environmental law framework for the prevention of soil contamination, for the management of contaminated soils and for consumers health protection in relation to agricultural crops. Some important aspects of the legislative framework for the prevention and management of soil contamination include recognising the possible risk to both human health and ecosystems that certain agricultural and industrial activities pose given the use of organic and inorganic chemical substances of a hazardous nature and pathogenic microorganisms. It is worth highlighting the milestone that many national constitutions include about the right to the environment. This right entails the obligation to protect it and to, therefore, protect soil from any degradation, including contamination. Legislation that protects soil from contamination and, consequently human health and ecosystems, is related mainly to agricultural activities (use of sewage sludge on farmlands, use of wastewater for irrigation, use of organic fertilisers and pesticides), and to industrial and commercial soil-contaminating activities. Consumer protection may be achieved through a legal system of environmental liability, specific measures to prevent contaminants entering soil, managing contaminated soils and a food traceability system. It is crucial to make the penalties for soil contamination offenses, and for violators of protective prohibitions, effective, proportionate and dissuasive. Global standards and guidelines on soil contamination could provide national legislative systems with substantive and procedural legal mechanisms to help prevent and manage soil contamination.