Oftentimes yes, but it depends on the feat and the spell. Deadly Aim often doesn't work since most ranged spells target touch AC, and some other feats apply specifically to weapons. If it is a feat that references a ranged weapon, then ray spells will usually work with it but most others won't.