The moon's gravitational force pulls water towards it, creating a high tide on the surface of the ocean closest to the moon. Also, the centrifugal force created by the Earth and moon orbiting around a central point creates a similar bulge on the opposite side, creating a second high tide.
Ordinarily, the Earth's gravitational field pulls down on the liquid on the planet's surface. The moon's own gravity partially offsets this effect, resulting in slightly lower gravity on the side of the Earth facing the moon. This change in the gravitational field is not strong enough to affect most solid objects, but the water molecules in the oceans and other large bodies are susceptible to the change, creating a bulge in the surface of the water that follows the moon around the Earth. Water on the opposite side of the planet is not affected by this gravitational pull, since the Earth's mass is in the way. This water is affected by the centrifugal force of the planetary spin, pushing it outwards.
The sun also has a small effect on the Earth's tides. When the moon and sun line up, the tides created are higher than those that occur when the moon's gravity is working perpendicular to the sun's own pull. In addition, the moon's variable distance from the Earth during its orbit can also have an effect on the height of tidal variations.