Most earthquakes happen near the boundaries of tectonic plates, both where the plates spread apart and where they crunch or grind together (although large temblors also strike from time to time in the normally stable interior of continents). Along plate boundaries, the brittle outer part of the Earth fractures along faults. As plates move, blocks of crust shift along the faults. The infamous San Andreas fault is not a single crack where the North American and Pacific plates slide past each other. It's the largest of a thicket of faults that collectively absorb the motion of the plates.
There are various kinds of faults that do the day-to-day dirty work of plate tectonics. The San Andreas is a "strike-slip" fault. (See animation below.) Along this seam, the plates slide past each other like cars traveling opposite directions on a highway. The other major family of faults are called "dip-slip" faults. (See animation below.) On these, blocks of crust either push together or pull apart, with one block sliding either up or down a sloped fault plane. The fault that let loose the 1994 Northridge earthquake was a dip-slip fault, at which a block of crust slid up the shallow ramp of anot
Stress builds up in fault zones when crustal blocks stick together. In fact, faults are stuck, or "locked," most of the time, although some also show slow, barely detectable slippage called "aseismic creep." The important distinction for people between the different kinds of slip has to do with that word, seismic, from the Greek for "shaking." Fault creep is aseismic (that is, not seismic) because it doesn't generate vibrations in the crust called seismic waves. But when a fault is stuck, the rocks on either side of it store the building stresses until a critical limit is reached, and the rocks move suddenly along the fault, releasing the stresses like a spring uncoiling. This pumps seismic waves into the surrounding rock.
Seismic energy travels through the crust in the form of waves. There are two basic kinds of seismic waves: body waves and surface waves. Body waves travel outward in all directions, including downward, from the quake's focus -- that is, the particular spot where the fault first began to rupture. Surface waves, by contrast, are confined to the upper few hundred miles of the crust. They travel parallel to the surface, like ripples on the surface of a pond. They are also slower than body waves.