Using convex optimization to help solve nonconvex problems in engineering is an area of intense research activity. In this thesis we study a specific nonconvex optimization problem called magnitude least-squares that has applications primarily in magnitude filter design. Solving the problem is difficult because of the existence of many local minima. We study it in depth, deriving methods for its approximate solution, proving equivalences among differing formulations, relating it to other well-studied problems, and proving estimates of the quality of the solutions obtained using the methods. We discover structure in the problem that distinguishes it from some more general problems of the same algebraic form. The structure is related to the fact that the variables in the problem are complex-valued. We exploit this structure when proving bounds on the quality of solutions obtained using semidefinite relaxation. In addition to a detailed and generally abstract study of this specific optimization problem, we solve several practical problems in signal processing. Some of the application examples serve to illustrate the applicability of the magnitude least-squares problem, and include multidimensional magnitude filter design, magnitude filter design for nonlinearly delayed tapped filters, and spatial filtering using arbitrarily positioned array elements. We also present several application examples that illustrate the modeling capabilities of convex optimization. We use least-squares techniques to reason about the capabilities of clustered arrays of loudspeakers to accurately synthesize radiation patterns. We also provide an elegant convex optimization-based procedure for designing linear-phase audio equalizers.