Increasing heat dissipation density is becoming a limiting factor in air-cooled data centers. The main control objective in data center thermal management is to keep the temperature of all the data processing equipment below a certain threshold and at the same time maximize the energy efficiency of the system. Existing work in this field does not take into account unexpected changes in the workload and neglects the cost of control actions taken by the cooling infrastructure. To address this problem, we derive a thermodynamic model of a data center and propose a novel model-based temperature control strategy that combines air flow control and thermal-aware scheduling. The air flow controller is responsible for the long-term decisions by switching between multiple operating points, whereas the scheduler accounts for short-term fluctuations in the workload that are not predictable. Simulations with synthetic and real workload traces show that we can control the temperatures at the racks in an efficient and stable manner with this approach.