In this article, a fourth-order compact and conservative scheme is proposed for solving the nonlinear Klein-Gordon equation. The equation is discretized using the integral method with variational limit in space and the multidimensional extended Runge-Kutta-Nyström (ERKN) method in time. The conservation law of the space semidiscrete energy is proved. The proposed scheme is stable in the discrete maximum norm with respect to the initial value. The optimal convergent rate is obtained at the order of O(h 4 ) in the discrete L ∞ -norm. Numerical results show that the integral method with variational limit gives an efficient fourthorder compact scheme and has smaller L ∞ error, higher convergence order and better energy conservation for solving the nonlinear Klein-Gordon equation compared with other methods under the same condition.