Waves can be longitudinal or transverse.
In transverse waves, the oscillations are at right angles to the direction of travel and energy transfer.
Water waves and S waves are also transverse waves.
In longitudinal waves, the oscillations are along the same direction as the direction of travel and energy transfer.
Sound waves and waves in a stretched spring are longitudinal waves. P waves are also longitudinal waves.
Longitudinal waves show areas of compression and rarefaction. In the slideshow below, the areas of compression are where the parts of the spring are close together, while the areas of rarefaction are where they are far apart.