Let L be a holomorphic line bundle over a compact Kahler manifold X. Motivated by mirror symmetry, we study the deformed Hermitian–Yang–Mills equation on L, which is the line bundle analogue of the special Lagrangian equation in the case that X is Calabi–Yau. We show that this equation is the Euler-Lagrange equation for a positive functional, and that solutions are unique global minimizers. We provide a necessary and sufficient criterion for existence in the case that X is a Kahler surface. For the higher dimensional cases, we introduce a line bundle version of the Lagrangian mean curvature flow, and prove convergence when L is ample and X has non-negative orthogonal bisectional curvature.