In this paper, we propose a task scheduling strategy for an Internet of Things (IoT) node powered by renewable energy (RE). The node is assumed to have a rechargeable battery and an RE harvester. Moreover, the node is requested to perform M tasks over a planning period of N ≥ M time slots. Each task is assigned a priority rating and a reward. With these considerations we develop a mathematical framework to optimize the utility of the node, defined as the sum of rewards over the specified planning horizon. Using the proposed framework, we derive a genie-aided strategy, which serves as a performance benchmark for online algorithms. We then propose an online task scheduling strategy, which uses existing forecasting methods to estimate future RE production. We finally evaluate the performance of the proposed strategy and its robustness to forecasting errors through extensive simulations. The impact of system parameters such as battery size and RE harvesting capacity are also examined numerically.