As the routing protocol can greatly influence the energy consumption of the sensor nodes in research field of wireless sensor networks. In this paper, we present a novel distributed hash table based routing algorithm for wireless sensor networks. Distributed hash table is a kind of distributed memory approach, of which the single node can be expanded to the whole Internet. Particularly, each node is controlled by a part of the whole resource space, and the related index information can be saved on it. In the proposed routing algorithm, each node in wireless sensor networks can be allocated an ID using hash functions. Afterwards, each node maintains a routing table, and then the selective information can be transmitted through the routing table. Next, we present a modified finger table named speedup finger table, and then used it in the wireless sensor networks routing algorithm. Finally, we design a series of experiments to verify the effectiveness of the proposed algorithm. Experimental results demonstrate that compared with the existing related works, the proposed routing algorithm is effective and can obviously reduce the energy consumption.