Hamon romped to victory over former prime minister Manuel Valls in Sunday's primary, AFP reported.
He will go up against an array of candidates in April's first round of voting for president, from far-right leader Marine Le Pen and right-wing candidate Francois Fillon to Macron in the center and Jean-Luc Melenchon on the far left.
The election is being closely watched after the victory for the Brexit camp in Britain and Donald Trump's triumph in the United States.
Polls currently show Hamon will be eliminated at the first hurdle as the Socialists pay the price for five years in power under deeply unpopular President Francois Hollande.
Hamon, who came from behind with a radical left-wing program, faces a fight to prevent moderate Socialist voters from switching to 39-year-old former investment banker Macron, who says he is neither of the left nor the right.
Adding to the uncertainty of a wide-open race, longtime frontrunner Fillon's popularity has taken a hit after claims his wife Penelope was paid half a million euros ($535,000) for a fictitious job as his parliamentary aide.
Hamon's triumph is another upset in the topsy-turvy French race, with the former education minister and son of a dockworker viewed as an outsider only three weeks ago.
As he savored victory, Hamon urged the fractured left to pull together, appealing to hard-left candidate Melenchon and environmentalist contender Yannick Jadot to build a "governmental majority".
"Our country needs the left, but a modern, innovative left turned towards the future," 49-year-old Hamon told supporters.
Macron, who created his own En Marche (On the Move) party to contest the elections, has indicated he would be open to alliances but is considered highly unlikely to throw his hat in with the Socialists.
Valls, who conceded defeat and wished Hamon well on Sunday, took a parting shot at Le Pen, saying that Socialists "reject (her) face being the face of France in the future".
Le Pen believes the nationalist sentiment that influenced British and American voters in 2016 will also carry her to the French presidency in what would be a profound shock for Europe.
But her anti-immigration and anti-EU National Front party is also embroiled in its own expenses scandal over money from the European Parliament.