Ionic bonding occurs when atoms combine to form ions that are held together by electrostatic attraction between oppositely charged ions. Metals bond ionically with nonmetals by transferring electrons from the metal to the nonmetal, forming cations and anions that bond to create an electrically neutral compound. Examples provided are sodium (Na+) bonding with fluorine (F-), magnesium (Mg2+) bonding with chlorine (Cl-), and aluminum (Al3+) bonding with oxygen (O2-).