Bless weapon, magic fang and greater magic fang all grant a 50% chance to strike incorporeal creatures. Both magic weapon and greater magic weapon do the same for a monk's unarmed strikes, which the Player's Handbook defines as a natural weapon. Blink grants a 50% chance to strike ethereal creatures. Ethereal jaunt, etherealness, plane shift and gate all let you become ethereal yourself.
There are several other spells outside the core rules that do what you want, and even a few more I can think of within the core rules which might have that result in peculiar circumstances.