Lt-Col Arnaud Beltrame, 45, "fell as a hero" and showed "exceptional courage", French President Emmanuel Macron said.
The gendarme helped bring an end to a gunman's shooting spree that killed three in southern France.
The radical Islamist gunman, 25-year-old Redouane Lakdim, was shot dead as police brought the siege to an end.
Announcing the police officer's death on Twitter, Interior Minister Gérard Collomb said: "He died for his country. France will never forget his heroism, his bravery, his sacrifice."
The supermarket was sealed off by the police as the siege unfolded
Earlier, Mr Macron had revealed that Lt-Col Beltrame had suffered serious injuries and was fighting for his life in hospital.
Sixteen people were injured, two seriously, in what Mr Macron called an act of "Islamist terrorism".
Lakdim was said to have demanded the release of Salah Abdeslam, the most important surviving suspect in the 13 November 2015 attacks in Paris, which killed 130 people.
One person – believed to be Lakdim's partner – has been arrested in connection with the shootings.
What led up to Friday's siege?
The violence began on Friday morning in Carcassonne, where Lakdim hijacked a car. He killed a passenger – whose body was later found hidden in a bush – and injured the driver.
He then shot at a group of policemen who were out jogging, wounding one of them.
Eye-witness says French hostage-taker ran after him
Lakdim is then believed to have driven a short distance to the small town of Trèbes, where he stormed into the Super-U supermarket, shouting, "I am a soldier of Daesh [Islamic State]!"
He killed two people – a customer and a store worker – before seizing others as hostages.
At what point was the officer wounded?
Mr Collomb told reporters on Friday that police officers had managed to get some people out of the supermarket but the gunman had held one woman back as a human shield.
It was at this point, he said, that Lt-Col Beltrame had volunteered to swap himself for her.
As he did so, he left his mobile phone on a table with an open line so that police outside could monitor the situation.
When police heard gunshots, a tactical team stormed the supermarket. The gunman was killed but Lt-Col Beltrame was injured.
After the announcement of his death early on Saturday, France's Gendarmerie Nationale – a police force part of the military – honoured its fallen "comrade", saying Lt-Col Beltrame "gave his life for the freedom of the hostages".
What do we know about Redouane Lakdim?
Lakdim, was born in April 1992 in Morocco and had French nationality. He was known to French intelligence services.
Prosecutor Francois Molins said he had been on an extremist watch-list due to "his radicalisation and his links with the Salafist movement", a hardline offshoot of Sunni Islam. However, subsequent investigations by intelligence services had not turned up any signs he would act, he said.
In 2011 Lakdim was found guilty of carrying a prohibited weapon and in 2015 he was convicted for drug use and refusing a court order, Mr Molins said.
Earlier, Mr Collomb said that though Lakdim had been known to authorities as a petty criminal, they "did not think he had been radicalised".
Lakdim lived in an apartment in Carcassonne with his parents and several sisters. A neighbour saw him taking one of his sisters to school on Friday morning.
The family's apartment was raided by police on Friday afternoon.