Nitroglycerin is a medication commonly used in the treatment of angina pectoris (chest pain) and heart failure. It works by relaxing and dilating blood vessels, which increases blood flow to the heart muscle, thereby reducing its workload and oxygen demand.