We prove that one-relator groups with negative immersions are hyperbolic and virtually special; this resolves a recent conjecture of Louder and Wilton. The main new tool we develop is a refinement of the classic Magnus-Moldavanskii hierarchy for one-relator groups. We introduce the notions of stable HNN-extensions and stable hierarchies. We then show that a one-relator group is hyperbolic and has a quasi-convex one-relator hierarchy if and only if it does not contain a Baumslag-Solitar subgroup and has a stable one-relator hierarchy. Finally, we give an algorithm that, given as input a one-relator group, verifies if it has a stable hierarchy and, if so, determines whether or not it contains a Baumslag-Solitar subgroup.