Recent advances in battery technologies have reduced the financial burden of using the energy storage system (ESS) for customers. Peak cut, one of the benefits of using ESS, can be achieved through proper charging/discharging scheduling of ESS. However, peak cut is sensitive to load-forecasting error, and even a small forecasting error may result in the failure of peak cut. In this paper, we propose a two-phase approach of day-ahead optimization and real-time control for minimizing the total cost that comes from time-of-use (TOU), peak load, and battery degradation. In day-ahead optimization, we propose to use an internalized pricing to manage peak load in addition to the cost from TOU. The proposed method can be implemented by using dynamic programming, which also has an advantage of accommodating the state-dependent battery degradation cost. Then in real-time control, we propose a concept of marginal power to alleviate the performance loss incurred from load-forecasting error and mimic the offline optimal battery scheduling by learning from load-forecasting error. By exploiting the marginal power, real-time ESS charging/discharging power gets close to the offline optimal battery scheduling. Case studies show that under load-forecasting uncertainty, the peak power using the proposed method is only 22.4% higher than the offline optimal peak power, while the day-ahead optimization has 76.8% higher peak power than the offline optimal power. In terms of profit, the proposed method achieves 77.0% of the offline optimal profit while the day-ahead method only earns 19.6% of the offline optimal profit, which shows the substantial improvement of the proposed method.