Objective: The objective of this study was to compare the efficacy of inhaled iloprost and nitric oxide (iNO) in reducing pulmonary hypertension (PHT) during cardiac surgery immediately after weaning from cardiopulmonary bypass (CPB). Design: A prospective randomized study. Setting: A single-center university hospital. Participants: Forty-six patients with PHT (mean pulmonary artery pressure (mPAP) >=26 mmHg preoperatively at rest, after anesthesia induction, and at the end of CPB) scheduled to undergo cardiac surgery were enrolled. Interventions: Patients were randomly allocated to receive iloprost (group A, n = 23) or iNO (group B, n = 23) during weaning from CPB. Measurements and Main Results: Heart rate, mean arterial pressure, central venous pressure, pulmonary artery pressure (PAP), pulmonary capillary wedge pressure, and left atrial pressure were recorded continuously. Iloprost and iNO were administered immediately after the end of CPB before heparin reversal. Both substances caused significant reductions in mean PAP (mPAP) and pulmonary vascular resistance (PVR) and significant increases in cardiac output 30 minutes after administration (p < 0.0001). However, in a direct comparison, iloprost caused significantly greater reductions in PVR (p = 0.013) and mPAP (p = 0.0006) and a significantly greater increase in cardiac output (p = 0.002) compared with iNO. Conclusions: PHT after weaning from CPB was significantly reduced by the selective pulmonary vasodilators iNO and iloprost. However, in a direct comparison of the 2 substances, iloprost was found to be significantly more effective.