Greenhouse gases trap heat in the atmosphere, leading to the greenhouse effect and global warming.