Earthquakes on the San Andreas fault in California are due to lateral motion between the Pacific and Americas plates. Some sections of the fault are locked (to a fraction of their depth) between major earthquakes while others are free-sliding. We model this problem by considering two semi-infinite plates sliding past each other. Near the fault an inner solution in the vertical cross-plane is obtained. If the length of the locked sections is large compared with the thickness of the plates an outer solution exists in which the stress and strain components are constant across the plates. Such solutions are obtained for (i) a single locked section, (ii) two locked sections separated by a central crack. The inner and outer solutions are asymptotically matched, and the results used to predict the distribution of stress and strain near the fault. The creep velocities on the freesliding sections are shown to be a fraction of the relative plate velocity. When a great earthquake occurs on one locked section it appears that a significant fraction of the relieved stress is transferred to each adjacent locked section. An expression is obtained for the strain energy so released.