Turn the gas valve located on the water heater to the off position. Wait a few minutes to allow the gas in the lines to dissipate for safety reasons.
Switch the valve to the pilot setting and hold it pressed into place unless there is a red button near the valve. If the red button is present, then press that instead. This starts the gas flow through the pilot tube, allowing you to light it.
Strike a match and hold it to the end of the pilot gas supply tube until a flame appears just off the end of the tube. This should take just a few seconds. For newer heaters, a match is not needed, as the pilot will self-light. An indicator light will turn on to show that the pilot is lit. Continue to hold the valve or red button down for a few minutes to allow the water heater's heat sensor to heat up. This keeps the heater from shutting back down because it does not sense that the pilot is back on.
Release the pressure placed onto the valve or the red button next to it and turn the valve back to the on position to ignite the heater's flame.