The natural processes—biological, chemical, or physical—that take place within an ecosystem. Ecosystem functions include decomposition, production of plant matter, and photosynthesis.