During the assault, six German soldiers in a trench near York charged him with fixed bayonets. York had fired all the rounds in his M1917 Enfield rifle, but drew his .45 Colt automatic pistol and shot all six soldiers before they could reach him.

German First Lieutenant Paul Jürgen Vollmer, commander of the First Battalion, 120th Landwehr Infantry, emptied his pistol trying to kill York while he was contending with the machine guns. Failing to injure York, and seeing his mounting losses, he offered in English to surrender the unit to York, who accepted. By the end of the engagement, York and his seven men marched 132 German prisoners back to the American lines. His actions silenced the German machine guns and were responsible for enabling the 328th Infantry to renew its attack to capture the Decauville Railroad.

York was promptly promoted to Sergeant and awarded the Distinguished Service Cross for his heroism. A few months later, following a thorough investigation, he was awarded the Medal of Honor, presented to York by the commanding general of the American Expeditionary Force, General John J. Pershing. The French Republic awarded him the Croix de Guerre and the Legion of Honor. Italy awarded him its Croce di Guerra al Merito and Montenegro its War Medal. He eventually received nearly 50 decorations. His Medal of Honor citation reads:

After his platoon suffered heavy casualties and 3 other noncommissioned officers had become casualties, Cpl. York assumed command. Fearlessly leading 7 men, he charged with great daring a machine gun nest which was pouring deadly and incessant fire upon his platoon. In this heroic feat the machine gun nest was taken, together with 4 officers and 128 men and several guns.

Of his deeds, York said to his division commander, General George B. Duncan, in 1919:

A higher power than man power guided and watched over me and told me what to do.

A goverment of men to defend the rights of each man and each man to defend the rights of all men.