Looks good for Company A, C, K, or G, 72nd Indiana Volunteer Infantry issued in 1864 (no day or month given). All the Spencer Rifles in that range of serial #s were issued to the listed companies. Closest to your # 5312 is # 5309 issued to Company C, and #5314 issued to Company A. Same unit.
Two Flints