Quantum teleportation is one of the crucial protocols in quantum information processing. It is important to accomplish an efficient teleportation under practical conditions, aiming at a higher fidelity desirably using fewer resources. The continuous-variable (CV) version of quantum teleportation was first proposed using a Gaussian state as a quantum resource, while other attempts were also made to improve performance by applying non-Gaussian operations. We investigate the CV teleportation to find its ultimate fidelity under energy constraint identifying an optimal quantum state. For this purpose, we present a formalism to evaluate teleportation fidelity as an expectation value of an operator. Using this formalism, we prove that the optimal state must be a form of photon-number entangled states. We further show that Gaussian states are near-optimal while non-Gaussian states make a slight improvement and therefore are rigorously optimal, particularly in the low-energy regime.