When fired, the revolver puts a distinct marking (a "fingerprint") on the shell.
The shell casing is up against the breech face and the firing pin. The bullet is fired when the hammer makes contact with the primer. When this happens, the shell is thrown back against the breech face. This action is what places the "fingerprint" onto the base of the shell casing (marks which match the breech face to the shell casing). The marks on the breech face matching the marks on the shell casing is what is what proves that the shell casing was fired from that specific weapon, to the exclusion of every other weapon in the world.
Joseph Nicol (Superintendent of the Bureau of Criminal Identification & Investigation for the State of Illinois)
Cortlandt Cunningham, Robert Frazier, Charles Killion (all three of the Firearms Identification Unit of the FBI Laboratory in Washington D.C.)
These four experts each examined the shell casings found at the scene at Tenth and Patton as well as Oswald's revolver (taken from him upon his apprehension at the theater). Using this manner of ballistic testing, these investigators, independent of each other, determined that the shells were linked to Oswald's revolver to the exclusion of every other weapon in the world.