Energy efficiency is an essential requirement for wireless sensor networks while security must also be ensured for mission-critical applications. In this paper, we present an energy-efficient distributed deterministic key management scheme (EDDK) for resource-constrained wireless sensor networks. EDDK mainly focuses on the establishment and maintenance of the pairwise keys as well as the local cluster keys and can fix some flaws in some existing key management schemes. Not only can the neighbor table constructed during key establishment provide the security for key maintenance and data transfer, but it can also be used to effectively manage the storage and update of the keys. By using the elliptic curve digital signature algorithm in EDDK, both new and mobile sensor nodes can join or rejoin a sensor network securely. Unlike some centralized and location-based key management schemes, EDDK does not depend on such infrastructure as base stations and robots and thus has a high level of flexibility. Experiments and analyses show that EDDK has a very low overhead in terms of computation, communication, and storage.