Many energy aware routing algorithms and protocols have been proposed for wireless sensor networks recently to achieve aims like minimum energy consumption, maximized network lifetime, reduced communication latency and overhead etc. The problem of hotspot can not be well addressed under many routing algorithms since some nodes which are on the shortest path or close to the base station tend to deplete their energy quickly and consequently cause network partition. In this paper, we propose a Ring-based Energy Aware Routing (REAR) algorithm for wireless sensor networks which can achieve both energy balancing and energy efficiency for all sensor nodes. Our algorithm considers not only the hop number and distance but also the residual energy of the next hop node during routing process. Simulation results validate that our algorithm outperforms some other routing algorithms in the aspects of energy consumption and network lifetime etc.