Advances in observational and computational seismology in the past two decades have made it possible for fully automatic and real-time determinations of the focal mechanisms of point earthquake sources. However, sources of all large and small earthquakes are intrinsically finite and heterogeneous, both temporally as well as spatially. Therefore, a full picture of the source slip distribution is essential not only for a better understanding of earthquake physics but also for accurate account of the source directivity effect for reliable and realistic predictions of earthquake-induced strong ground motions. We develop a source inversion technique that combines a well-established slipdistribution inversion method and an efficient algorithm for computing accurate synthetics in 3D structures based on a preestablished strain Green tensor database. This new technique makes it practical for slip-distribution inversion in 3D structures, which not only enhances the capability of resolving source slip distributions of moderate earthquakes through better accounting of the effects of lateral structural heterogeneities but also provides an effective tool for the development of automatic systems for near-real-time inversions of earthquake source slip distributions for seismic-hazard mitigation purposes.