In ecology, an ecosystem is a community of organisms (plant, animal and other living organisms - also referred as biocenose) together with their environment (or biotope), functioning as a unit.

The term ecosystem first appeared in a 1935 publication by the British ecologist Arthur Tansley. However, the term had been coined already in 1930 by Tansley's colleague Roy Clapham, who was asked if he could think of a suitable word to denote the physical and biological components of an environment considered in relation to each other as a unit.

An ecosystem is a dynamic and complex whole, interacting as an ecological unit. Some consider it is a basic unit in ecology, only a structured functional unit in equilibrium, caracterized by energy and matter flows between the different elements that compose it. But others consider this vision or a self-standing unit with coherent and stable flows only to be a bit restrictive.

An ecosystem may be of very different size. It may be a whole forest, as well as a small pond. Different ecosystems are often separated by geographical barriers, like deserts, mountains or oceans, or are isolated otherwise, like lakes or rivers. As these borders are never rigid, ecosystems tend to blend into each other. As a result, the whole earth can be seen as a single ecosystem, or a lake can be divided into several ecosystems, depending on the used scale.

The organisms in an ecosystem are usually well balanced with each other and with their environment. Introduction of new environmental factors or new species can have disastrous results, eventually leading to the collapse of an ecosystem and the death of many of its native species. The abstract notion of ecological health, and the more specific biodiversity metric, attempts to measure the robustness and capacity for recovery of a natural ecosystem.

Ecosystem and ecoregion terms are often confused (large ecosystems being called ecoregions), but there is a large consensus to define ecoregions as being geographical defined units, relatively large, land or water, with distinctive features. Ecoregions are a way to codify the different regions within which are observed particular patterns or similarities in ecosystems.

Ecosystem valuation (of which the most extreme is the attempt to assign the value of Earth) and environmental health measures are usually thought to be part of economics rather than being within the science of ecology. This is because they deal with human perceptions rather than with the ecological system as it exists independently of human observers and "users".

See also Biome, Edge effect, trophic level, food chain, Biosphere, Biosphere 2, Ecological yield, biogeochemical cycle