Buildings are fundamental components of cities. Understanding the function of buildings is therefore of great importance for urban development and management. Some studies have identified building functions using spatiotemporal data, which assumes that buildings with the same function have similar temporal activity patterns. However, these methods present difficulties in coping with the situation when buildings with the same function have heterogeneous activity patterns. To solve this problem, this research proposes a new method to identify building functions from the perspective of the spatial distribution and spatial interactions of human activities. First, taxi data were used to acquire the spatiotemporal interaction characteristics among buildings with different functions. Then, the spatiotemporal population density distribution was adopted to depict the building vitality. Finally, an iterative clustering method was introduced to identify the building functions. The proposed scheme was applied in the Haizhu district of Guangzhou and compared with the traditional method. The results prove that the spatial interaction characteristics are more helpful than the temporal variation characteristics and therefore can be used to improve the accuracy of building function identification. A higher accuracy for identifying building functions can be realized by combining the spatiotemporal interactions and building vitality characteristics. The overall accuracy reaches 0.8566, with a Kappa coefficient of 0.8174, which are both better than the results of using a single characteristic only.