Mahut and Benneteau, both 36, claimed the first set in only 18 minutes. Lopez and Granollers won only four points during the opener.
When Lopez served at the start of the second, the question was could the French continue their domination?
Not quite. The Spaniards won their first game of the match thanks to some crisp serving from Lopez. Seemingly bewildered by sudden jump in quality, Benneteau served a double fault. However he recovered his poise to hold his serve and level at 1-1.
The French got the break to lead 3-1 and kept their composure to collect the second 6-4 after 60 minutes of play
After holding at the start of the third set, the Spanish collected the serve of the French pair for the first time to lead 2-0. Granollers held his own to make it 3-0.
But the Spaniards could not sustain their grip and the French levelled at 4-4 before taking the shootout nine points to seven.
“I’d like to thank the players for their efforts,” said France captain Yannick Noah. “It is great to share this happiness. These are precious moments.”
Benneteau, who came out of retirement to play in place of several injured players including Jo-Wilfried Tsonga and Mahut’s usual partner Pierre-Hugues Herbert, said: “It has been magical to have a chance to experience these kind of moments. The doubles is always a great day.
"I’ve known Nicolas since we were 12 when we played in a singles match. And now nearly 25 years later we are playing together to get a point to take France into the Davis Cup final. It’s very emotional.”
The French will play Croatia or the United States in the showdown between 23 and 25 November.