Raj Sandhu, 55, was caught on CCTV footage battling the thugs at Maypole Stores in Welford-on-Avon, Warwickshire, on Monday night.
Despite suffering bruises in his arm, he was successful in forcing the robbers to flee with just some cash they could grab on the way out.
"It was gut instinct. I thought if I didn't fight back, they would hit me over the head with it (the hammer)," Mr Sandhu told Coventry Telegraph.
"I was trying to get behind the counter as that is where the panic button is, but the vibrations (of what happened) set it off anyway," he said.
Mr Sandhu was emptying the cash machine when the robbers barged into the shop but their attention was focussed on a Post Office safe housed in the shop.
When they were unable to open that, they turned on the shopkeeper who used the cardboard boxes around him to defend himself.
The robbers have been caught on the CCTV picking up some cash off the floor and fleeing outside to get away in a dark coloured Mercedes.
"We've been here (for) 25 years and have had break-ins but nothing like this," said Mr Sandhu.
"It's shocking but he was really brave. I'm really proud of him for being so strong during this difficult time," his daughter-in-law Bobbi said.
Warwickshire Police is appealing for witnesses to come forward who may have seen "anything suspicious".
"Fortunately, the victim only suffered minor injuries but he has been left feeling shaken. The shop is on the main road through Welford so someone passing by may have seen the incident or seen the men coming or going from the store," said Detective Sergeant Richard Simpkins.