Space heating accounts for a significant share of a building's energy use; moreover, occupants' desires for better thermal comfort may further increase the energy use and peak load of the space heating system, as well as its total energy cost. The goal of this study was to use an optimal control technique: model-based predictive controller, to improve the energy and economic performance of space heating systems with satisfying indoor temperature. The proposed optimal controller incorporated the dynamic energy prices, the disturbances from weather and occupancy, as well as a nonlinear system dynamic model that considered the building thermal mass as thermal energy storage. The model-based predictive controller was tested by simulation on a university building in central Norway, and its control performance was compared to a conventional rule-based control approach, which is currently employed by the case system. The model-based predictive controller's effectiveness was demonstrated by a 2.8% reduction in heat use, 8.8% shaving in peak load, 3.8% saving in heating cost, and a 59% drop in indoor temperature violation. Furthermore, a sensitivity study revealed that the model-based predictive controller still maintained high energy and economic performance even under lightweight building constructions with decreased building thermal mass.