With the weapon pointed at her face and her seven year old daughter clinging to her skirt, Mrs Ranvir Bassi refused to hand over money, pushed the gun away and chased the masked gunman to the door of her shop in Stafford.
Recorder Mr Michael Elsom said at Stafford Crown Court: "Mrs Bassi displayed quite extraordinary bravery in taking hold of the weapon."
The teenager, who was 17 at the time and cannot be named, will be sentenced at a later date.
He admitted attempted robbery, possessing a firearm with intent to commit robbery and possessing a prohibited weapon.
The video recording of 35-year-old Mrs Bassi tackling the gunman was put on the internet by Staffordshire Police in an effort to catch the offender.
She was shutting the shop 10 minutes early to visit her son Gurdip, aged eight, who is in hospital suffering from severe eczema, when the attacker stormed in.
Mr Phillip Beardwell, prosecuting, said the teenager had been 'seemingly bragging about being on Youtube'. He boasted 'they haven't got enough evidence'.
But police found the defendant's trainers near Mrs Bassi's shop in Rickerscote Road, Stafford and the shotgun discarded among some old bike frames nearby.
Mr Beardwell said the gun's stock had been crudely cut down and the barrel shortened. Staffordshire Police's armorer reported it was an old weapon in a poor state which could have been repaired and put in to working condition by someone who knew what they were doing. It was loaded with a live 12-bore round.
Mrs Bassi, her daughter and the defendant would not have known it was not capable of being fired in its condition.
Mr Beardwell said the defendant had been in to the shop to buy some sweets about 6.30pm on November 4 last year. He returned two hours later, masked and carrying the shotgun in a yellow carrier bag.
The video showed him entering the store, pointing the gun at Mrs Bassi, who reacted quickly and within moments was chasing the gunman out and locking the door.
Mr Beardwell said the defendant had put forward a basis of plea in which he maintained he had been under pressure from others to commit the robbery. The Crown did not accept it, but would not have a trial over it.
"At the time he was associating with people who were on the periphery of a local organised crime group.
"The Crown's view is this was either braggadocio to earn his stripes, or it was something done under direction. The evidence is he attended the store alone and he left the store alone."
Mr Michael Anning, defending, said: "He is a very young man to be dealt with for very serious offences.
"He didn't persist in his threats, it was a scene which was over in a short period of time. This is not a determined and experienced criminal.
"He was under pressure in relation to a debt they said he owed. The gun was given to him by them to commit this offence."
Mrs Bassi said: "I was about to close up because I wanted to get to the hospital. I was closing up and had gone out the back when he came in and started shouting 'Give me the money' and swearing.
"He was screaming and pointing the gun, so I just pushed him out of the way and started shouting and swearing back at him."