Abstract An electrohydraulic system, which is widely applied in practice, is a highly nonlinear system with uncertainty. In order to improve the control performance, the nonlinearity and uncertainty should be taken into consideration. In this context, a lot of researches have been carried out, and most of them need the derivatives of the tracking error to construct their controllers. However, the accurate values of the derivatives are difficult to be obtained in practice. What's more, without considering the characteristics of the reference signal, the direct applications of these control methods in the periodic motion tracking problem of electrohydraulic systems are difficult to achieve satisfactory control performances. Therefore, a novel internal model principle (IMP)-based sliding mode control (SMC) is proposed in the paper. First, an ideal driving force for the second-order piston motion dynamics is designed based on the IMP with the measurement of piston position. And then, the deviation between the ideal and measured driving force is selected as the sliding mode variable. At last, the SMC is formed to guarantee the actual driving force can converge to the ideal one in finite time. As the main contribution of this paper, the proposed IMP-based SMC does not need the derivatives of the tracking error and can achieve a better performance by eliminating the reference frequency related component in the tracking error. To verify the control performance of the proposed method, a 20 Hz sinusoidal reference tracking scenario is considered, and the finite-time exact differentiator (FTD)-based SMC and the FTD-based high-order SMC (HOSMC) are selected as comparison methods. A group of simulations are performed on an electrohydraulic system used in the controlled trajectory rapid compression and expansion machine (CT-RCEM). The simulation results show that the 20 Hz component in the tracking error is eliminated under the proposed controller, but the 20 Hz error components are still remaining as 2.58 mm and 0.64 mm under the FTD-based SMC and the FTD-based HOSMC, respectively.