How are tectonic earthquakes produced?

Predominantly due to friction. Major earthquakes (the ones you hear about on the news) occur at collision (where two tectonic plates are smashing together) and conservative (where two plates slide side-by-side) boundaries.

Rocks (which obviously make up tectonic plates) can undergo two types of deformation, ductile (or plastic) and brittle. When you put stress on these rocks, which happens when they rub against each other, they will usually undergo ductile deformation providing the stress is constant and fairly low. If you've ever been to a big mountain range like the Himalaya, you'll see folds in the rocks. This is ductile deformation.

Earthquakes occur when the stress reaches a point called the rupture point. When this point is reached, the rocks will not fold and twist, they'll simply break and energy is released, an earthquake. In plate tectonics, this happens in the Wadati-Benioff Zone (in collision boundaries).

The best illustration for this ductile/brittle deformation process is using one of those plastic rulers found in schools around the world (Staedtler type). You can bend the ruler and it will actually bend quite a long way. However, it will reach a critical point where it will stop bending and just snap, releasing energy in the process. This energy is effectively the same as seismic waves in earthquakes (albeit on a much smaller scale) that will cause material around it to vibrate. Big enough vibrations = buildings collapse.

Source: geography teacher and geology graduate.