Container terminals are essential intermodal interfaces in the global transportation network. Efficient container handling at terminals is important in reducing transportation costs and keeping shipping schedules. In this paper, we study the storage space allocation problem in the storage yards of terminals. This problem is related to all the resources in terminal operations, including quay cranes, yard cranes, storage space, and internal trucks. We solve the problem using a rolling-horizon approach. For each planning horizon, the problem is decomposed into two levels and each level is formulated as a mathematical programming model. At the first level, the total number of containers to be placed in each storage block in each time period of the planning horizon is set to balance two types of workloads among blocks. The second level determines the number of containers associated with each vessel that constitutes the total number of containers in each block in each period, in order to minimize the total distance to transport the containers between their storage blocks and the vessel berthing locations. Numerical runs show that with short computation time the method significantly reduces the workload imbalance in the yard, avoiding possible bottlenecks in terminal operations.