Compared with seismic waves, near-field static deformation can provide more robust constraints on earthquake size and slip distribution because it is less sensitive to the rupture process and Earth structure. The static deformation data are now obtained using space-geodetic measurements. For early warning and rapid hazard assessment, such geodetic measurements are less useful because they are usually available only with a time delay of days to weeks or even longer. Recent studies have shown that coseismic static displacements can be estimated from modern seismometer records after an appropriate correction for baseline errors that may be caused by rotational motion, tilt, instrument, and other effects. For this purpose, several empirical baseline correction methods have been proposed. Algorithms, in which an acceleration or other acceleration record derived threshold is used to determine the timing of baseline shift, can be easily implemented. In practice, however, the baseline shift is not necessarily accompanying the strongest ground shaking; methods based on the threshold approach tend to lead to an over- or underestimation of the true baseline shift. Other correction schemes, which can be performed by manual calibration, rely on subjective decisions for the choice of correction parameters. In this paper, an automatic scheme is presented, in which the method used to determine the baseline shift has a stronger physical basis. Case studies on the 1999 Chi-Chi, 2007 Tocopilla, 2008 Wenchuan, and 2010 Maule earthquakes, where the strong-motion data were obtained from different types of accelerometers, show that this automatic scheme is more robust than the previously suggested ones. In all test cases, the coseismic displacements recovered from the strong-motion records agree within 10%-20% with direct GPS measurements or indirect model predictions. In addition, the automatic scheme was also successfully used to correct the strong-motion records of a low-cost sensor obtained from a laboratory test.