Direct imaging of the steeply dipping structures is challenging for conventional reverse time migration (RTM), especially when there are no strong reflectors in the migration velocity model. To address this issue, we have enhanced the imaging of the steeply dipping structures by incorporating the prismatic waves. We formulate the imaging problem in a nonlinear least-squares optimization framework because the prismatic waves cannot be linearly mapped from the model perturbation. Primary and prismatic waves are jointly imaged to provide a single consistent image that includes structures illuminated by both types of waves, avoiding the complexities in scaling and/or interpreting primary and prismatic images separately. A conjugate gradient algorithm is used to iteratively solve the least-squares normal equation. This inversion procedure can become unstable if directly using the recorded data for migration because it is hindered by the crosstalk caused by imaging primary waves with the prismatic imaging operator. Therefore, we isolate the prismatic waves from the recorded data and image them with the prismatic imaging operator. Our scheme only requires a kinematically accurate and smooth migration velocity model, without the need to explicitly embed the strong reflectors in the migration velocity model. Realistic 2D numerical examples demonstrate that our method can resolve the steeply dipping structures much better than conventional least-squares RTM of primary waves.