Suffolk County Police say the man entered the store on East Main Street in Patchogue and removed money from the register.
When he tried to flee, police say he was halted by customers who saw the robbery and held the door closed from the outside, locking him inside the store.
Police say the suspect then smashed through a plate glass window, cutting himself, and took off.
The group of Good Samaritans pursued him and called police.
The suspect was arrested a short time later.
He is identified as 47-year old Glen Gregor of Patchogue.
Gregor was treated for his cuts at Brookhaven Memorial Hospital Center, and is charged with third degree robbery.