You may already know about the relationship between temperature and pressure: When you pressurize air (or any gas), it gets hotter, and when you release the pressure on air, it gets colder. So, a bicycle pump gets hot when you pump up a tire, and a spray paint can or a C02 cartridge gets cold as you release the pressurized gas.
You may also know that air pressure decreases as altitude increases. This table shows the pressure (in pounds per square inch) at different altitudes:
So, how does elevation affect climate? As air rises, the pressure decreases. It is this lower pressure at higher altitudes that causes the temperature to be colder on top of a mountain than at sea level.