In this paper, we develop an ontology-based framework for energy management in buildings. We divide the functional architecture of a building energy management system into three interconnected modules that include building management system (BMS), benchmarking (BMK), and evaluation & control (ENC) modules. The BMS module is responsible for measuring several useful environmental parameters, as well as real-time energy consumption of the building. The BMK module provides the necessary information required to understand the context and cause of building energy efficiency or inefficiency, and also the information which can further differentiate normal and abnormal energy consumption in different scenarios. The ENC module evaluates all the information coming from BMS and BMK modules, the information is contextualized, and finally the cause of energy inefficiency/abnormality and mitigating control actions are determined. Methodology to design appropriate ontology and inference rules for various modules is also discussed. With the help of actual data obtained from three different rooms in a commercial building in Singapore, a case study is developed to demonstrate the application and advantages of the proposed framework. By mitigating the appropriate cause of abnormal inefficiency, we can achieve 5.7%, 11.8% and 8.7% energy savings in Room 1, Room 2, and Room 3 respectively, while creating minimum inconvenience for the users.