When an earthquake occurs, it releases energy in the form of seismic waves that radiate from the earthquake source in all directions. The different types of energy waves shake the ground in different ways and also travel through the earth at different velocities. The fastest wave, and therefore the first to arrive at a given location, is called the P wave. The P wave, or compressional wave, alternately compresses and expands material in the same direction it is traveling. The S wave is slower than the P wave and arrives next, shaking the ground up and down and back and forth perpendicular to the direction it is traveling. Surface waves follow the P and S waves.