This paper presents a method for wing aerostructural analysis and optimization, which needs much lower computational costs, while computes the wing drag and structural deformation with a level of accuracy comparable to the higher fidelity CFD and FEM tools. A quasi-three-dimensional aerodynamic solver is developed and connected to a finite beam element model for wing aerostructural optimization. In a quasi-three-dimensional approach an inviscid incompressible vortex lattice method is coupled with a viscous compressible airfoil analysis code for drag prediction of a three dimensional wing. The accuracy of the proposed method for wing drag prediction is validated by comparing its results with the results of a higher fidelity CFD analysis. The wing structural deformation as well as the stress distribution in the wingbox structure is computed using a finite beam element model. The Newton method is used to solve the coupled system. The sensitivities of the outputs, for example the wing drag, with respect to the inputs, for example the wing geometry, is computed by a combined use of the coupled adjoint method, automatic differentiation and the chain rule of differentiation. A gradient based optimization is performed using the proposed tool for minimizing the fuel weight of an A320 class aircraft. The optimization resulted in more than 10 % reduction in the aircraft fuel weight by optimizing the wing planform and airfoils shape as well as the wing internal structure.