Nanopositioning systems driven by piezoelectric actuators are widely used in different fields. However, the hysteresis phenomenon is a major factor in reducing the positioning accuracy of piezoelectric actuators. This effect makes the task of accurate modeling and position control of piezoelectric actuators challenging. In this paper, the learning and generalization capabilities of the model are efficiently enhanced to describe and compensate for the rate-independent and rate-dependent hysteresis using a kernel-based learning method. The proposed model is inspired by the classical Preisach hysteresis model, in which a set of hysteresis operators is used to address the problem of mapping, and then least-squares support-vector machines (LSSVM) combined with a particle swarm optimization (PSO) algorithm are used for identification. Two control schemes are proposed for hysteresis compensation, and their performance is evaluated through real-time experiments on a nanopositioning platform. First, an inverse model-based feedforward controller is designed based on the LSSVM model, and then a combined feedback/feedforward control scheme is designed using a classical control strategy (PID) to further enhance the tracking performance. For performance evaluation, different datasets with a variety of hysteresis loops are used during the simulation and experimental procedures. The results show that the proposed method is successful in enhancing the generalization capabilities of LSSVM training and achieving the best tracking performance based on the combination of feedforward control and PID feedback control. The proposed control scheme outperformed the inverse Preisach model-based control scheme in terms of both positioning accuracy and execution time. The control scheme that uses the LSSVM based on nonlinear autoregressive exogenous (NARX) models has significantly less computational complexity compared to our control scheme but at the expense of accuracy.