Let M be a compact real-analytic manifold, equipped with a real-analytic Riemannian metric g, and let β be a closed real-analytic 2-form on M , interpreted as a magnetic field. Consider the Hamiltonian flow on T * M that describes a charged particle moving in the magnetic field β. Following an idea of T. Thiemann, we construct a complex structure on a tube inside T * M by pushing forward the vertical polarization by the Hamiltonian flow "evaluated at time i." This complex structure fits together with ω − π * β to give a Kähler structure on a tube inside T * M . We describe this magnetic complex structure in terms of its (1, 0)-tangent bundle, at the level of holomorphic functions, and via a construction using the embeddings of Whitney-Bruhat and Grauert, which is a magnetic analogue to the analytic continuation of the geometric exponential map. We describe an antiholomorphic intertwiner between this complex structure and the complex structure induced by −β, and we give two formulas for local Kähler potentials, which depend on a local choice of vector potential 1-form for β. When β = 0, our magnetic complex structure is the adapted complex structure of Lempert-Szőke and Guillemin-Stenzel.We compute the magnetic complex structure explicitly for constant magnetic fields on R 2 and S 2 . In the R 2 case, the magnetic adapted complex structure for a constant magnetic field is related to work of Krötz-Thangavelu-Xu on heat kernel analysis on the Heisenberg group.