Anomaly detection is one of the most challenging topics in hyperspectral imaging due to the high spectral resolution of the images and the lack of spatial and spectral information about the anomaly. In this paper, a novel hyperspectral anomaly detection method called morphological profile and attribute filter (MPAF) algorithm is proposed. Aiming to increase the detection accuracy and reduce computing time, it consists of three steps. First, select a band containing rich information for anomaly detection using a novel band selection algorithm based on entropy and histogram counts. Second, remove the background of the selected band with morphological profile. Third, filter the false anomalous pixels with attribute filter. A novel algorithm is also proposed in this paper to define the maximum area of anomalous objects. Experiments were run on real hyperspectral datasets to evaluate the performance, and analysis was also conducted to verify the contribution of each step of MPAF. The results show that the performance of MPAF yields competitive results in terms of average area under the curve (AUC) for receiver operating characteristic (ROC), precision-recall, and computing time, i.e., 0.9916, 0.7055, and 0.25 seconds, respectively. Compared with four other anomaly detection algorithms, MPAF yielded the highest average AUC for ROC and precision-recall in eight out of thirteen and nine out of thirteen datasets, respectively. Further analysis also proved that each step of MPAF has its effectiveness in the detection performance.