Crowds gathered outside St John the Baptist Church in Cudworth, near Barnsley, South Yorkshire, as the family, friends and colleagues of Captain Martin Driver, 31, from 1st Battalion The Royal Anglian Regiment, arrived with his coffin.
Around 200 people, many in tears, crowded in the street as speakers relayed the funeral from the packed church.
Capt Driver died in the UK on March 15 after being wounded by a roadside bomb in the Musa Qala district in February. The officer, from Barnsley, was on his second tour of Afghanistan and had previously served in Iraq and Northern Ireland with 4th Battalion The Parachute Regiment.
He died at the Royal Centre for Defence Medicine at Selly Oak, in Birmingham, but later died.
The mourners were led by his parents, his fiance Johanna Sellway and his twin brother David.
His coffin was draped with a Union Flag and had a wreath of red poppies on top. Inside the hearse was a bouquet of white lilies.
After his death his family thanked the medical teams who tried to save him and said: "He died doing a job he loved. His dedication and professionalism will remain an inspiration to all."