Over the last years, a number of query-based routing protocols have been proposed for Wireless Sensor Networks (WSNs). In this context, routing protocols can be classified into two categories, energy savers and energy balancers. In a nutshell, energy saving protocols aim at decreasing the overall energy consumed by a WSN, whereas energy balancing protocols attempt to efficiently distribute the ... [Show full abstract] consumption of energy throughout the network. In general terms, energy saving protocols are not necessarily good at balancing energy and vice versa. In this paper, we introduce an Energy-aware Query-based Routing protocol for WSNs (EQR), which offers a good trade-off between the traditional energy balancing and energy saving objectives. This is achieved by means of learning automata along with zonal broadcasting so as to decrease the total energy consumption. We consider that, in the near future, EQR could be positioned as the routing protocol of choice for a number of query-based WSN applications, especially for deployments where the sensors show moderate mobility.