Enhanced index tracking is an emerging strategy for investing money in the stock market and is aimed at achieving outperformance over a given benchmark index while achieving a low tracking error. We consider the problem of rebalancing a portfolio for an enhanced index tracking strategy subject to various real-life constraints, including a lower bound and an upper bound on the expected tracking error. To solve this problem, we propose a three-phase approach consisting of preprocessing, optimization, and learning. In a computational experiment, we applied this approach to rebalance a given portfolio on a monthly basis over a time horizon of 10 years; the data for the S&P 500 benchmark index were provided by the investment company Principal Global Investors. Our approach generated portfolios that were provably close to optimality for all monthly rebalancing decisions. Over the entire horizon of 10 years, the portfolios devised by our approach yielded cumulative returns higher than the S&P 500 index after transaction costs with a moderate tracking error.