Minerals form through crystallization as elements in magma or dissolved in water solutions solidify into crystals. Magma crystallization produces minerals through slow cooling underground or rapid cooling when lava reaches the surface. Slowly cooled underground magma results in larger mineral crystals, while rapidly cooled lava produces smaller crystals. Water solutions deposit minerals as crystals through evaporation, such as salt precipitating from seawater.