Quantum annealing aims at solving hard computational problems through adiabatic state preparation. Here, I propose to use inhomogeneous longitudinal magnetic fields to enhance the efficiency of the annealing. Such fields are able to bias the annealing dynamics into the desired solution, and in many cases, suitable field configurations can be found iteratively. Alternatively, the longitudinal fields can also be applied as an antibias which filters out unwanted contributions from the final state. This strategy is particularly well suited for instances which are difficult to solve within the standard quantum annealing approach. By numerically simulating the dynamics for small instances of the exact cover problem, the performance of these different strategies is investigated.