One of the most critical problems affecting geophysical data acquisition procedures is related to the misorientation of multicomponent sensors with respect to a common reference system (e.g., geographic north). In many applications, misoriented sensors affect data analysis procedures, leading to errors in results and interpretations. These problems generally occur in applications where the orientation of the sensor cannot be actively controlled and is not known a priori, e.g., geophysical sensors deployed in borehole installations or on the seafloor. We have developed a quaternion-based method for the optimal reorientation of multicomponent geophysical sensors. In contrast to other approaches, we took into account the full time-series record from all sensor components. Therefore, our method could be applied to all time-series data and was not restricted to a certain type of geophysical sensor. Our method allows the robust calculation of relative reorientations between two-component or three-component sensors. By using a reference sensor in an iterative process, this result can be extended to the estimation of absolute sensor orientations. In addition to finding an optimal solution for a full 3D sensor rotation, we have established a rigorous scheme for the estimation of uncertainties of the resulting orientation parameters. We tested the feasibility and applicability of our method using synthetic data examples for a vertical seismic profile and an ocean bottom seismometer array. We noted that the quaternion-based reorientation method is superior to the standard approach of a single-parameter estimation of rotation angles.