Yes. Bullets carry their own oxidising agent in the explosive of the cartridge (which is sealed, anyway) so there’s no need for atmospheric oxygen to ignite the propellant.
Without the stabilising effect of the atmosphere, the wide temperature variations in space might be a problem though: direct sunlight might make the gun hot enough for the ammunition to explode spontaneously, whereas a gun kept in the shade would eventually become so cold that the primer in the firing cap might not go off at all. At very low temperatures, metals also become brittle and can stick together, which might cause the moving parts to jam.
Once shot, the bullet will keep going forever, as the universe is expanding at a faster rate than the bullet will travel.