The bill had the backing of the ruling socialists, leftist Podemos and smaller regional parties and passed with 176 votes in favor, but there were 165 abstentions and two against.
The Valley of the Fallen site near Madrid was described by a senior Podemos leader last month as "the last standing monument to fascist dictatorship in Europe", Presstv Reported.
But the plans to move Franco's remains have divided Spanish society. Several of his descendants issued a statement last month, expressing their "firm and unanimous" opposition to the exhumation.
The statement said the family hoped the Benedictine order in charge of the site, which is marked by a 152-meter-tall cross, would prevent the state's "vengefulness."
The government of Prime Minister Pedro Sanchez hopes Franco's exhumation will help settle grievances from the period of his rule that still cast a shadow over the country.
As many as 500,000 combatants and civilians died in the Spanish civil war. During Franco's 1939-1975 rule, tens of thousands of his opponents were killed or imprisoned.
Past political crimes were pardoned as part of Spain's transition to democracy in the late 1970s, fostering resentment among some families of victims.
Many hope to win permission to unearth remains of war dead at the Valley of the Fallen and in dozens of unmarked graves throughout the country.