Moment tensor inversion is a routine procedure to obtain information on an earthquake source for moment magnitude and focal mechanism. However, the inversion quality is usually controlled by factors such as knowledge of an earthquake location and the suitability of a 1-D velocity model used. Here we present an improved method to invert the moment tensor solution for local earthquakes. The proposed method differs from routine centroid-moment-tensor inversion of the Broadband Array in Taiwan for Seismology in three aspects. First, the inversion is repeated in the neighborhood of an earthquake's hypocenter on a grid basis. Second, it utilizes Green's functions based on a true three-dimensional velocity model. And third, it incorporates most of the input waveforms from strong-motion records. The proposed grid-based moment tensor inversion is applied to a local earthquake that occurred near the Taipei basin on 23 October 2004 to demonstrate its effectiveness and superiority over methods used in previous studies. By using the grid-based moment tensor inversion technique and 3-D Green's functions, the earthquake source parameters, including earthquake location, moment magnitude and focal mechanism, are accurately found that are sufficiently consistent with regional ground motion observations up to a frequency of 1.0 Hz. This approach can obtain more precise source parameters for other earthquakes in or near a well-modeled basin and crustal structure.