Magnet

A magnet is an object that possesses a natural magnetic field. Certain other materials, such as iron, are attracted to magnets while other magnets themselves, are repelled.

In 2152, the crew of unknowingly entered a cloaked Romulan minefield where one of the mines attached itself to the hull of the ship. Commander Charles Tucker later ascertained the mine was made of a magnetic material, designed to be attracted to a starship's hull. 

While searching for a lost runabout in 2369, Chief Miles O'Brien used the term "needle in a haystack" to describe the their situation, then suggesting they sent out a series of probes to scan for any interaction of the runabout's hull to the magnetic atmosphere of the planets, effectively using a "magnet" to locate their "needle." 

In 2372, Chief O'Brien played darts using magnets with his daughter, Molly. He later commented to Doctor Julian Bashir that it just wasn't the same as real darts.