Three-dimensional finite difference simulations of elastic waves in the San Bernardino Valley were performed for two hypothetical earthquakes on the San Andreas fault: a point source with moment magnitude M5 and an extended rupture with M6.5. A method is presented for incorporating a source with arbitrary focal mechanism in the grid. Synthetics from the 3-D simulations are compared with those derived from 2-D (vertical cross section) and 1-D (flat-layered) models. The synthetic seismograms from the 3-D and 2-D simulations exhibit large surface waves produced by conversion of incident S waves at the edge of the basin. Seismograms from the flat-layered model do not contain these converted surface waves and underestimate the duration of shaking. The seismograms from the 3-D simulations have larger amplitude coda than do the seismograms from the 2-D case because of the presence of off-azimuth surface wave arrivals in the 3-D simulations that are not included in the 2-D simulations. Snapshots of the wavefield of the 3-D simulation show that these off-azimuth arrivals represent surface waves reflected from the edges of the basin. The anelastic attenuation of the sediments is a key parameter controlling the overall duration of motion. Some of the coda energy at rock sites near the basin edges represents leakage of surface wave energy out of the basin. For the M6.5 earthquake simulation, the largest ground velocities occur where surface waves reflected from the edge of the basin interfere constructively with the trapped waves that follow the direct S-wave. Maps of maximum ground velocity are produced for two directions of rupture propagation. The largest velocities occur in localized portions of the basin. The location of the largest velocities changes with the rupture propagation direction. Contours of maximum shaking are also dependent on asperity positions and radiation pattern.