Anomaly detection (AD) is a crucial task for detecting salient objects in cluttered backgrounds. Classical AD algorithms based on statistical models or geometric models have achieved acceptable detection results. However, most of them do not hierarchically extract deep features or consider the spatial structure of the images. We propose a method that combines the reconstruction error of autoencoder (AE) and spatial morphological characteristics to estimate anomalousness. The reconstruction errors and the spatially dominant information are comprehensively considered. Specifically, given the compression capability of the AE, we use the dimensionality reduction results obtained by encoding for analyzing local pixel difference; an adaptive dual window is employed in this process. The morphological transformation commonly used in edge detection is utilized to refine the small space anomalies. Experimental results on different hyperspectral images show that the proposed AE and spatial morphology extraction-based approach significantly surpasses several traditional alternatives.