Feature extraction plays an essential role in hyperspectral image classification. Nonparametric feature extraction algorithms have more advantages than parametric ones and are well suited for nonnormally distributed data along with being able to extract more features than the classic linear discriminant analysis. In this paper, a novel nonparametric feature extraction method, namely, cosine-based nonparametric feature extraction (CNFE), is proposed, in which the weight function embedded in the within-class and between-class scatter matrices is developed based on cosine distance. Moreover, a powerful K-nearest neighbor (KNN) classification algorithm based on the distance metric formed by CNFE features is also developed, which is called the CNFE-based KNN (CKNN) classifier. The effectiveness of the proposed CNFE and CKNN is evaluated by two hyperspectral real data sets. The experimental results demonstrate that both the proposed CNFE and CKNN achieve remarkable performances on various types of training sample sizes, including the small-sample-size cases.