Sailors, during the age-of-sail, were very superstitious – of such things as The Flying Dutchman. That superstition continues today in many parts.
In order to combat the evil spirits, a horseshoe was nailed to the foremast and could be seen on most ships of the day.
This section of Victory’s foremast (?) is displayed within the ship at the Portsmouth Historic Dockyard in Portsmouth..
A cross section of a mast from HMS Victory also reveals the composition of the mast – obviously not hewn from a single tree.
This link from Google books mentions Herman Melville and HMS Victory, Lord Nelson and the horseshoe pinned to the foremast. http://goo.gl/4djDjI
On the old superstition:
"In a German work, entitled "Seespuk," by P. G. Heims, the writer remarks that, among seafaring people, the old pagan emblem, the horse-shoe, whose talismanic origin is so closely associated with horse-sacrifice and the use of horse-flesh as food among the heathen nations of the North, is even now the most powerful safeguard aboard ship against lightning and the powers of evil.
"There are comparatively few small vessels laden with wood, fruit, vegetables, or other merchandise, sailing between Baltic Sea ports, upon whose foremast, or elsewhere upon deck, horse-shoes are not nailed."
Taken from The Lucky Horseshoe - http://www.sacred-texts.com/etc/mhs/mhs18.htm