Legged robots' gait is a major factor in how well they walk. Because present solutions lack a precise approach to the incredibly complicatedstructure and sensitive motions of legged creatures, gait creation remains a highly challenging subject. This article proposes a gait generationmodel (WPG) for a spider robot to walk straight and follow the designed reference ZMP trajectory in 2 step cycles with two different speeds.Initially, the robot spider's gait parameters are determined using a nonlinear recurrent evolutionary neural network model (NARX+EANN),which is then used in a walking pattern generator (WPG). Next, a new gait pattern generator (WPG) that depends only on four parameters(step length, leg lift, knee bend, stride) of the small-sized spider robot is designed, by relying on realistic gait analysis of the spider robot andkinematic analysis. Simultaneously, by using analytical techniques to solve the inverse kinematics issue, 12 joint angle orbits at the spiderrobot's four legs will be determined from the hip and foot orbits at the spider robot's four legs. Then, the optimal weights of the NARX+EANNmodel are identified using the Jaya optimization algorithm for training with the objective function of minimizing the total error between theactual ZMP coordinates and the reference ZMP in two-step cycles of different speeds. The actual ZMP point is determined based on 12 jointangle orbits at the four legs of the spider robot by solving the forward kinematics problem using analytical methods. Finally, this proposal isapplied to the experimental model of the B3-SBOT spider robot. The obtained results demonstrate that B3-SBOT walks steadily and stronglywithout tilting, closely following the designed reference ZMP trajectory in 2 step cycles with two different speeds.