Susceptibility-induced magnetic field gradients (SFGs) perpendicular to the slice plane often result in signal dropout in blood oxygenation level-dependent (BOLD) functional magnetic resonance imaging (fMRI) experiments. Two-dimensional (2D) z-shim methods reduce these effects by acquiring multiple images with different slice refocusing gradient areas. In this work a 3D z-shim method is introduced as a more efficient alternative. The technique augments the k-space data for a conventional 3D phase encoding acquisition with N additional lines that extend the k(z) coverage sufficiently to sample k-space fully in regions with SFGs. Multiple subsets of these data are reconstructed using a sliding window that provides N +1 z-shim images. Fewer total acquisitions are required than with the 2D method for the same coverage, and finer z-shim steps are obtained. The technique is demonstrated with a motor task using intentionally introduced SFGs and compared with the 2D method. The results confirm increased BOLD SNR and activation with the new method in good agreement with theory. Magn Reson Med 42:290-299, 1999. Copyright 1999 Wiley-Liss, Inc.