Melenchon proposed the New Popular Union coalition after coming just shy of making it into the second round during last month's presidential election.
The Socialists were once the dominant party of the left and several left the party rather than submit to the coalition after a poor show in last month's vote.
"With the New Popular Union, we can win the legislative elections and change people's lives!" LFI lawmaker Manuel Bompard said.
France: A divided country
New left-wing leader
The proposal triggered a heated debate within the Socialist Party. Party delegates voted for the move with 167 in favor and 101 against, finally sealing the deal.
Although the former President of France Francois Hollande, who served his term just before Emmanuel Macron came to power, was from the Socialist Party, their popularity has seen a fast decline in subsequent years.
Their presidential candidate last month, Anne Hidalgo, secured only around 1.7% of the vote.
Melenchon claimed around 22% in the first round, just behind far-right candidate Marine Le Pen who got through to the second round on just over 23%.
However, the Socialist Party was also historically a key driver of EU integration, while Melenchon is avidly anti-EU.
Parliament up for grabs
It is not yet clear how well the new coalition would perform in June's parliamentary elections.
Recent polls showed Macron's party — renamed this week to Renaissance — set to win the vote, but the surveys were carried out before the various parties signed up to the coalition.
The far-right traditionally do not perform particularly well at parliamentary elections as other parties work together to block them.
In recent years, the president's party has also controlled the parliament, but if the leftist coalition wins, it may put Macon in a tricky situation. He is ultimately the person who picks the prime minister, but the parliament may dismiss the president's choice.
A parliament filled with an opposition majority could see Macron's presidential powers significantly curbed.
For many not a vote for Macron but to prevent Le Pen: DW's Max Hofmann