Florence Cassez, 38, was sentenced to 60 years in prison after she was arrested in 2005 at a ranch near Mexico City with her former boyfriend, who led a kidnapping gang called the Zodiacs.
Supreme Court Judge Jorge Pardo ordered her release during a televised court session, which at one point looked to be going against Cassez.
Hours later, she was whisked from a Mexico City prison in a vehicle flanked by police trucks to the capital's international airport where she was put on an Air France plane back home.
Cassez, who had maintained she was innocent, and her father were both pictured wearing black flak jackets as they left the prison.
"It's an explosion of joy. It's wonderful," Charlotte Cassez, her mother, told French television.
"It's not far from being the best day of my life. We've been waiting for so long. She deserves it. She is innocent and has fought to prove that. It's a victory for her."
The French government had sharply criticized Mexico for its treatment of Cassez and welcomed her release on Wednesday.
Outside the Mexican prison, however, relatives of kidnap victims wept as Cassez was freed.
"She's out, she's out," cried Michelle Valadez, who accused Cassez of being involved in her husband's kidnapping and screamed "murderer" as she lunged at the vehicle. "What about us?" she asked on local television.
After her arrest, police made Cassez take part in a staged scene of officers freeing kidnap victims. She was portrayed as a kidnapper in the re-enacted event, which was aired on national television. Police subsequently admitted wrongdoing.
A judge sentenced her in 2008 following a closed-door trial with no jury, typical of most cases in Mexico.
Her lawyers said Cassez was denied immediate consular assistance when she was arrested and that the evidence of key witnesses should be thrown out. A majority of the Supreme Court judges agreed, without saying she was innocent.
In March, the Supreme Court rejected a bid to release Cassez immediately but opened the door to a review on Wednesday, which had initially been intended to discuss a motion to invalidate some of the evidence used to convict her.
Cassez's fate appeared to be hanging in the balance for much of the hearing, when a majority of the five-judge panel said they would vote against the wording of Justice Olga Sanchez's proposal to discard testimony against Cassez.
Two judges dismissed Sanchez's motion on the grounds it was too lenient on Cassez, while two others rejected because it did not go far enough, instead arguing she should be released.
Then, in a startling turn of events, Sanchez, the last judge to speak, took up the objections and proposed a modified motion to release the Frenchwoman. Moments later Cassez was declared a free woman after a majority of the panel backed Sanchez's plan.
"It was an incredible somersault," said Luis Angel Benavides, a penal law professor at Mexico City's ITAM university. "It was a very complicated process and this session was utterly bizarre."
Critics of Mexican justice saw the Cassez case as a test of the system's ability to rectify its faults. But her release also stirred resentment among kidnapping victims. Thousands of serious crimes have gone unpunished by Mexico's justice system.
"Today the Supreme Court is freeing the guilty, only respecting their rights, while those of the victims have been thrown under the Arc de Triomphe (in Paris)," said Isabel Miranda de Wallace, a respected rights activist.
Still, Wednesday's ruling appeared to draw a line under the long-standing rift between France and Mexico over Cassez.
"Today we can say that between France and Mexico we have the best relations that can be established," French President Francois Hollande said on television after the ruling.
The case hung over former Mexican President Felipe Calderon, who staked his reputation on battling organized crime but ended up presiding over a sharp rise in gang-related violence.
Cassez's release could even pave the way for her to seek law suits against Calderon aides who oversaw her arrest.
"There are various authorities who were involved, and I'm sure all of them, I repeat all of them, now face the possibility of facing proceedings," said Senator Arturo Zamora, a member of the ruling Institutional Revolutionary Party, or PRI.
The departure of Cassez relieves new President Enrique Pena Nieto of a diplomatic headache. He took office in December, returning the PRI to power at the expense of Calderon's conservative National Action Party (PAN).
The PAN, meanwhile, condemned Cassez's release, and some of Calderon's prominent allies could barely contain their anger.
"All we need now is for them to line up outside the exit of the prison shouting long live the new Joan of Arc," Calderon's former labor minister, Javier Lozano, wrote on Twitter shortly after the court announced its decision.