Providing lift is the main function of the wing of an aircraft. A wing consists of two essential parts. The internal wing structure, consisting of spars, ribs, and stringers, and the external wing, which is the skin.
Ribs give the shape to the wing section, support the skin (prevent buckling), and act to prevent the fuel flowing around as the aircraft maneuvers. Its primary structural function is to withstand bending moments (the moment resultant of aerodynamic forces) and shear stresses (due to the vertical and horizontal resultant of forces). They serve as attachment points for the control surfaces, flaps, landing gear, and engines. They also separate the individual fuel tanks within the wing.
The wing stringers (also referred to as stiffeners) are thin strips of material (a beam) to which the skin of the wing is fastened. They run spanwise and are attached between the ribs. Their job is to stiffen the skin so that it does not buckle when subjected to compression loads caused by wing bending and twisting, and by loads from the aerodynamic effects of lift and control-surface movements.
The ribs also need to be supported, which is done by the spars. These are simple beams that usually have a cross-section similar to an I-beam. The spars are the most heavily loaded parts of an aircraft. They carry much more force at its root, than at the tip. Since wings will bend upwards, spars usually carry shear forces and bending moments.
Aerodynamic forces not only bend the wing, they also twist it. To prevent this, a second spar is introduced. Torsion now induces bending of the two spars. Modern commercial aircraft often use two-spar wings where the spars are joined by a strengthened section of skin, forming the so-called torsion-box structure. The skin in the torsion-box structure serves both as a spar-cap (to resist bending), as part of the torsion box (to resist torsion) and to transmit aerodynamic forces.