We consider N=2 supergravity in four dimensions, coupled to an arbitrary number of vector- and hypermultiplets, where abelian isometries of the quaternionic hyperscalar target manifold are gauged. Using a static and spherically or hyperbolically symmetric ansatz for the fields, a one-dimensional effective action is derived whose variation yields all the equations of motion. By imposing a sort of Dirac charge quantization condition, one can express the complete scalar potential in terms of a superpotential and write the action as a sum of squares. This leads to first-order flow equations, that imply the second-order equations of motion. The first-order flow turns out to be driven by Hamilton's characteristic function in the Hamilton-Jacobi formalism, and contains among other contributions the superpotential of the scalars. We then include also magnetic gaugings and generalize the flow equations to a symplectically covariant form. Moreover, by rotating the charges in an appropriate way, an alternative set of non-BPS first-order equations is obtained that corresponds to a different squaring of the action. Finally, we use our results to derive the attractor equations for near-horizon geometries of extremal black holes.