P-waves (primary) is the fastest wave; it is the first to arrive and it moves up and down. It can travel through different kinds of material whether solid, liquid or gas. It squeezes rocks in the same direction of waves travelling.

S-waves (secondary) on the other hand, is the second to arrive and can only travel through solid; it moves side by side. It causes rocks to move at right angles in relation to the direction of the waves.

For your info., here's another type of wave:
The Long-surface wave (L-waves) is the last to arrive for it is the slowest wave; can only travel along the earth's surface.