Anomalies in wireless sensor networks can occur due to malicious attacks, faulty sensors, changes in the observed external phenomena, or errors in communication. Defining and detecting these interesting events in energy-constrained situations is an important task in managing these types of networks. A key challenge is how to detect anomalies with few false alarms while preserving the limited energy in the network. In this article, we define different types of anomalies that occur in wireless sensor networks and provide formal models for them. We illustrate the model using statistical parameters on a dataset gathered from a real wireless sensor network deployment at the Intel Berkeley Research Laboratory. Our experiments with a novel distributed anomaly detection algorithm show that it can detect elliptical anomalies with exactly the same accuracy as that of a centralized scheme, while achieving a significant reduction in energy consumption in the network. Finally, we demonstrate that our model compares favorably to four other well-known schemes on four datasets.