With 60 percent of the votes in a Socialists' primary counted, the ex-education minister had won 58.65 percent against his rival Manuel Valls, a former prime minister who is closer to the center ground and embraces pro-business policies.
The Socialists, weakened and divided after the deeply unpopular presidency of Francois Hollande, are given next to no chance of getting beyond the first round of the election in April.
By choosing the 49-year-old traditional leftist Hamon over Valls, they give Macron a big group of middle-ground voters to aim at and a better chance of beating his close rivals on the right and far-right.
Sunday's result lays bare the deep fractures in the Socialist camp.
It takes the party back to the traditional pro-worker roots that got Hollande elected in 2012, and rejects the U-turn he made mid-way through his mandate - an as-yet unsuccessful attempt to kick-start growth and jobs by forcing through business-friendly reforms.
If Hamon fails to make an impact on the campaign, where the Socialist candidate trails behind four others in opinion polls could consign the party to the wilderness for the next five years or even lead to its breaking-up, analysts said.
The Socialist primary provided the last actor on the election chess-board of candidates and the battle lines are now sharply drawn in the race for the Elysee in a two-stage election on April 23 and May 7.
Conservative Francois Fillon, the Republicans' candidate, and far-right leader Marine Le Pen are still seen by opinion polls likely to meet in the May runoff.
But Fillon's campaign has been thrown off track by a press report accusing him of employing his wife as a parliamentary assistant on a big salary without doing any work, charges he denies.
The campaign of Macron, a 39-year-old centrist former economy minister who says he wants to bridge the Left and the Right and has shunned any party patronage, is also gathering momentum, opinion polls show - and he could still upset the balance.
The Socialists' choice now of Hamon, a traditional leftwinger, will only favor Macron's campaign, political campaigners say. Supporters of the business-friendly Valls, who like Macron has steered centrist policies, are likely to give their vote now to the popular ex-banker.