We consider a two-dimensional electron gas with strong spin-orbit coupling contacted by two superconducting leads, forming a Josephson junction. We show that in the presence of an in-plane Zeeman field the quasi-one-dimensional region between the two superconductors can support a topological superconducting phase hosting Majorana bound states at its ends. We study the phase diagram of the system as a function of the Zeeman field and the phase difference between the two superconductors (treated as an externally controlled parameter). Remarkably, at a phase difference of $pi$, the topological phase is obtained for almost any value of the Zeeman field and chemical potential. In a setup where the phase is not controlled externally, we find that the system undergoes a first-order topological phase transition when the Zeeman field is varied. At the transition, the phase difference in the ground state changes abruptly from a value close to zero, at which the system is trivial, to a value close to $pi$, at which the system is topological. The critical current through the junction exhibits a sharp minimum at the critical Zeeman field, and is therefore a natural diagnostic of the transition. We point out that in presence of a symmetry under a modified mirror reflection followed by time reversal, the system belongs to a higher symmetry class and the phase diagram as a function of the phase difference and the Zeeman field becomes richer.