"I announce today before you my decision to endorse the candidacy of general Michel Aoun for the presidency of the republic," Hariri said.
He described his decision as necessary to "protect Lebanon, protect the (political) system, protect the state and protect the Lebanese people."
The key endorsement looks likely to end a void in Lebanon's presidency that has lasted since May 2014, with the country's deeply divided parliament unable to agree a successor to Michel Sleiman.
The endorsement comes as a surprise, with speculation that it is the result of a deal that will allow Hariri to return as prime minister.
Hariri, a Sunni Muslim whose party leads a Western- and Saudi-backed political bloc, had fiercely opposed Aoun's candidacy.
Aoun is allied with the Shiite movement Hezbollah, which is backed by Iran and has dispatched fighters to neighbouring Syria to bolster the regime of President Bashar al-Assad.
Speaking to his supporters, Hariri said the endorsement came after he had exhausted all other options and was intended "to preserve the political system, reinforce the state, relaunch the economy and distance us from the Syrian crisis."
Signup to our newsletter and follow us on Facebook and Twitter!
"We want to protect our country from this crisis," he added.
The war in neighbouring Syria has deepened existing divisions in Lebanon, with Hezbollah and its allies backing Assad's regime, while Hariri and his partners support the uprising against him.
More than one million Syrian refugees have also sought shelter in Lebanon, straining the country's already-stretched resources and infrastructure.
Lebanon's parliament is now expected to convene next week for a session to vote on the president -- the 46th such session since Sleiman's term expired.
Lebanon's president is elected by parliament, and the post is always reserved for a Maronite Christian under a power-sharing agreement.
Ex-general Aoun, 81, is a controversial figure.
He served as head of the armed forces and briefly as prime minister during Lebanon's 1975-1990 civil war, when he was a staunch opponent of Syrian military presence in Lebanon.
But he shocked many by brokering an alliance with Damascus ally Hezbollah in 2006, a year after his return from exile in France and after Syria pulled its troops from Lebanon.