Arnaud Beltrame, who once served in Iraq, had been raced to hospital fighting for his life after the siege in which he took the place of a female hostage at the Super U store in the town of Trebes, near the Pyrenees mountains.
"He fell as a hero, giving up his life to halt the murderous outfit of a jihadist terrorist," President Emmanuel Macron said in a statement shortly before dawn on Saturday.
Friday's attacker was identified by authorities as Redouane Lakdim, a 25-year-old Moroccan-born French national from the city of Carcassonne, not far from Trebes, a tranquil town of about 5,000 people where he struck on Friday afternoon.
Lakdim was known to authorities for drug-dealing and other petty crimes, but had also been under surveillance by security services in 2016-2017 for links to the radical Salafist movement, Paris prosecutor Francois Molins said on Friday.
The attacker, whose rampage began when he shot at a group of police joggers and also shot the occupants of a car he stole, killed three people and injured 16 others on Friday, according to a government readout.
Beltrame was part of a team of gendarmes who were among the first to arrive at the supermarket scene; most of the people in the supermarket escaped after hiding in a cold storage room and then fleeing through an emergency exit.
He offered to trade places with a hostage the attacker was still holding, whereafter he took her place and left his mobile phone on a table, line open. When shots rang out, elite police stormed the building to kill the assailant. Police sources said Beltrame was shot three times.
The 44-year-old's death takes the number killed to four.
Daesh has claimed responsibility for the attack. Macron has said security services are checking that claim.
More than 240 people have been killed in France in attacks since 2015 by assailants who either pledged allegiance to Daesh or were inspired by the group.
France is part of a group of countries whose warplanes have been bombing Daesh strongholds in Iraq and Syria, where the group has lost substantial ground in recent months.
One multiple attack by extremist gunmen and suicide bombers killed 130 people in Paris while another killed close to 90 when a man ran a truck into partying crowds in the Riviera seaside city of Nice.
Beltrame, who would have turned 45 in April, was a qualified parachutist who served in Iraq in 2005. He also worked as part of the elite Republican Guard that protects the presidential Elysee Place offices and residence in Paris, Macron said.
Friday's assault was the first deadly attack since October 2017, when a man stabbed two young women to death in the port city of Marseille before soldiers killed him.
Several attacks over the past year or more have targeted police and soldiers deployed in big numbers to protect civilians and patrol sensitive spots such as airports and train stations.
Macron said of Beltrame: "In offering himself as a hostage to the terrorist holed up in the Trebes supermarket, lieutenant colonel Beltrame saved the life of a civilian hostage, showing exceptional self-sacrifice and courage."
The news of Beltrame's death was first announced France's interior minister, who said in a Twitter post: "Dead for his country. France will never forget his heroism, bravery and sacrifice."