Image representation and classifier are playing key roles in image classification. An effective combination of image representation and classifier could raise the accuracy of image classification. A novel image classification algorithm based on sparse coding and random forest is proposed in this paper. Sparse coding is adopted to train a dictionary of visual words and then to convert SIFT descriptors into sparse vectors. Afterward several pooling methods and spatial partition are used to pool these sparse vectors to represent images. Random forest, an efficient multiclass classifier, is employed to classify the sparse vectors of images. The outcome of the experiments demonstrates that the proposed algorithm outperforms the state-of-the-art in image classification using Caltech-101 and Scene-15 datasets.