The application of the complex variable finite element method, ZFEM, to structures containing residual stresses is detailed. A thick-walled sphere model is subjected to an autofrettage process to induce the residual stress field and solved using ZFEM. The stress results from ZFEM are compared to an analytical solution and to standard finite element results. Sensitivities are calculated with respect to material parameters and to the applied load. The ZFEM partial derivative results are shown to provide excellent accuracy when compared with numerical derivatives of the analytical solution and finite differencing of standard finite element solutions. Hence, ZFEM provides an effective step-size independent method to compute shape, material and loading sensitivities for structures subjected to residual stresses.