It is of great clinical significance in the differential diagnosis of primary central nervous system lymphoma (PCNSL) and glioblastoma (GBM) because there are enormous differences between them in terms of therapeutic regimens. In this paper, we propose a system based on sparse representation for automatic classification of PCNSL and GBM. The proposed system distinguishes the two tumors by using of the different texture detail information of the two tumors on T1 contrast magnetic resonance imaging (MRI) images. First, inspired by the process of radiomics, we designed a dictionary learning and sparse representation-based method to extract texture information, and with this approach, the tumors with different volume and shape were transformed into 968 quantitative texture features. Next, aiming at the problem of the redundancy in the extracted features, feature selection based on iterative sparse representation was set up to select some key texture features with high stability and discrimination. Finally, the selected key features are used for differentiation based on sparse representation classification (SRC) method. By using ten-fold cross-validation method, the differentiation based on the proposed approach presents accuracy of 96.36%, sensitivity 96.30%, and specificity 96.43%. Experimental results show that our approach not only effectively distinguish the two tumors but also has strong robustness in practical application since it avoids the process of parameter extraction on advanced MRI images.