This study explores the potential of a novel hyperspectral snapshot mosaic camera for weed and maize classification. The image processing, feature engineering and machine learning techniques were discussed when developing an optimal classification model for the three kinds of weeds and maize. A total set of 185 spectral features including reflectance and vegetation index features was constructed. Subsequently, the principal component analysis was used to reduce the redundancy of the constructed features, and the first 5 principal components, explaining over 95% variance ratio, were kept for further analysis. Furthermore, random forests as one of machine learning techniques were built for developing the classifier with three different combinations of features. Accuracy-oriented feature reduction was performed when choosing the optimal number of features for building the classification model. Moreover, hyperparameter tuning was explored for the optimal selection of random forest model. The results showed that the optimal random forest model with 30 important spectral features can achieve a mean correct classification rate of 1.0, 0.789, 0.691 and 0.752 for Zea mays, Convolvulus arvensis, Rumex and Cirsium arvense, respectively. The McNemar test showed an overall better performance of the optimal random forest model at the 0.05 significance level compared to the k-nearest neighbours (KNN) model.