Provided herein are methods for treating pulmonary hypertension. The methods include administering to a subject in need thereof an effective amount of a vasodilator, wherein the vasodilator is administered to the subject via inhalation pro re nata using a portable inhaler. In some embodiments, the vasodilator is a PDE5 inhibitor. Pharmaceutical compositions for pro re nata administration of vasodilators are also described.