Ore Magnet is a treasure found in Hollow Hill treasure chests. Point the ore magnet at the ground (or at a wall), charge it up, and release. If you are lucky, the ore magnet will bring anything from an ore block to a whole vein right up to the surface for you. Each ore magnet will bring 24 blocks, and perhaps a few more to the surface.
The ore magnet does not work on coal, but will otherwise work on any ore. It will even attempt to find ore blocks added by other mods, as long as they have "Ore" in their name. It attempts to find blocks by searching through solid rock in the direction the player is facing, with a range of 32 blocks. It has 12 durability and uses up 1 durability for each block brought to the surface, and ores will only replace stone, dirt, grass blocks, gravel and air.