Describing the events that led up to his death, the MoD said that Pte Gray's A company, also known as the Vikings, had engaged five Taliban militants preparing an ambush near the town of Now Zad.
But the British patrol was then attacked by a larger Taliban force armed with mortars, 107mm rockets, rocket-propelled grenades and heavy machine guns.
Pte Gray sustained a serious gunshot wound in the ensuing battle, with a Chinook rescue helicopter entering the fray to evacuate him to the British base at Camp Bastion.
However, he was pronounced dead on arrival by an army doctor.
Pte Gray's family said in a statement: "He was a much loved and cherished son, grandson and brother, who was proud to serve his country. He will always be missed."
And the Leicester-born soldier's commanding officer Lieutenant Colonel Stuart Carver described the young solider as a "highly respected member of 1st Royal Anglian".
"It came as no surprise to those that knew him that he died courageously in close combat, selflessly striving to relieve comrades in extreme danger," he continued.
"He was a true Viking who we will never forget. Our sympathy and thoughts are with his family and friends at this very difficult time."
British troops are operating in Afghanistan as part of Nato's International Security Assistance Force (Isaf).
Click here to run an energy price comparison, and see if you could be paying less for your gas and electricity.