In this paper, we show how to achieve close-to-optimal utility performance in energy-harvesting networks with only finite capacity energy storage devices. In these networks, nodes are capable of harvesting energy from the environment. The amount of energy that can be harvested is time-varying and evolves according to some probability law. We develop an online algorithm, called the Energy-limited Scheduling Algorithm (ESA), which jointly manages the energy and makes power allocation decisions for packet transmissions. ESA only has to keep track of the amount of energy left at the network nodes and does not require any knowledge of the harvestable energy process. We show that ESA achieves a utility that is within O(ε) of the optimal, for any ε > 0, while ensuring that the network congestion and the required capacity of the energy storage devices are deterministically upper-bounded by bounds of size O(1/ε). We then also develop the Modified-ESA (MESA) algorithm to achieve the same O(ε) close-to-utility performance, with the average network congestion and the required capacity of the energy storage devices being only O([log(1/ε)]2), which is close to the theoretical lower bound O(log(1/ε)).