In this paper, the NMR and direct shear tests were conducted successively on cement mortar specimens with different curing ages (7 days, 14 days and 28 days). The porosity, shear strength, shear stiffness and shear energy of cement mortar are measured and analyzed through interpreting the pore distribution patterns and their corresponding fractal dimensions. The crosssections of shear surface were characterized into point cloud data via 3D laser scanning and quantified by three dimensionless parameters (the root mean square value of the first derivative, root mean square value and joint roughness coefficient). The grey relation analysis (GRA) method and principal component analysis (PCA) is employed to analyze the relationship between the pore structures (i.e., gel pores, transition pores, capillary pores and pores or cracks) and distribution and the fractal dimensions. The results indicate that the shear peak strength is linearly correlated with the joint roughness coefficient. Compared to the fractal characteristics of pore size (T2 spectra) and pore distribution (MRI), we demonstrated that there is a strong correlation between the peak shear strength and the fractal dimension of shear fracture surface, which suggests that the quantitative characterization of internal pores and shear strength variations in cement mortar specimens can be achieved through the numerical values of fractal dimensions.