We present an algebraic framework which simultaneously generalizes the notion of linear subspaces, matroids, valuated matroids, and oriented matroids, as well as phased matroids in the sense of Anderson-Delucchi. We call the resulting objects matroids over hyperfields. In fact, there are (at least) two natural notions of matroid in this context, which we call weak and strong matroids. We give "cryptomorphic" axiom systems for such matroids in terms of circuits, Grassmann-Plücker functions, and dual pairs, and establish some basic duality theorems. We also show that if F is a doubly distributive hyperfield then the notions of weak and strong matroid over F coincide.