For any d≥2, we prove that there exists an integer n0(d) such that there exists an n×n magic square of dth powers for all n≥n0(d). In particular, we establish the existence of an n×n magic square of squares for all n≥4, which settles a conjecture of Várilly-Alvarado. All previous approaches had been based on constructive methods and the existence of n×n magic squares of dth powers had only been known for sparse values of n. We prove our result by the Hardy-Littlewood circle method, which in this setting essentially reduces the problem to finding a sufficient number of disjoint linearly independent subsets of the columns of the coefficient matrix of the equations defining magic squares. We prove an optimal (up to a constant) lower bound for this quantity.