Adapted from U.S. Geological Survey photo by S. R. Brantley. (fair use policy)
Large eruptions of basalt lava may create deep flows of molten rock. As the rock slowly cools it shrinks slightly. The stresses cause jointing in several different planes, and columns of rock form with a generally hexagonal shape, like pencils. The flow shown here is at Sheepeaters Cliff, in Yellowstone National Park. Note that there is a strongly developed horizontal jointing here, too.
The piece of basalt below displays the six-sided cross section of a column. Some columns may have five or seven sides instead.
(c) 2004 Andrew Alden, licensed to About.com, Inc. (fair use policy)
Another picture of basalt columns is available as a free wallpaper image.