The majority of sprawling-posture quadrupedal vertebrates, such as geckos and lizards, adopt a cyclical lateral swing pattern of their trunk that is coordinated with limb movements to provide extraordinary flexibility and mobility. Inspired by the gecko's locomotory gait and posture, a gecko-like robot with a flexible spine driven by shape memory alloy (SMA) springs was proposed in this work. The static parameters of the SMA spring were experimentally measured, and the flexible spine driven by SMA springs can be deflected bidirectionally. A kinematic model of the spine mechanism was established, and the mathematical relationship between the thermodynamic behavior of the SMA springs and spinal deflection was systematically analyzed. When a gecko trots with a lateral swing pattern of its trunk, the body and the spine show a standing wave shape and a single-peak C-type curve, respectively. The lateral spine deflection and trotting gait were combined in a collaborative model of a flexible spine and limbs to describe in detail the specific relationships between leg joint variables and spine deflection angle. Planar motion tests of a prototype robot were also conducted by using four high-speed cameras to record the trajectory of each point of the body, which verified the proposed model. From the acquired results, it was demonstrated that, compared with a rigid body, a robot with a flexible spine has a longer stride length, higher speed, and a greatly reduced turning radius.