Kernel partial least squares regression (KPLS) is a technique used in several scientific areas because of its high predictive ability. This paper proposes a methodology to simultaneously estimate both the parameters of the kernel function and the number of components of the KPLS regression to maximize its predictive ability. A metaheuristic optimization problem was proposed taking the cumulative cross-validation coefficient as an objective function to be maximized. It was solved using nature-inspired metaheuristic algorithms: the genetic algorithm, particle swarm optimization, grey wolf optimization and the firefly algorithm. To validate the results and have a reference measure of the efficiency of the natureinspired metaheuristic algorithms, derivative-free optimization algorithms were also applied: Hooke-Jeeves and Nelder-Mead. The metaheuristic algorithms estimated optimal values of both of the kernel function parameters and the number of components in the KPLS regression. INDEX TERMS Partial least squares regression, kernel-based method, cross-validation method, and nature-inspired metaheuristic algorithms.