Sensor Glasses can help you locate nearby ores. To use the glasses, place them in the helmet armor location in the inventory. An interface will then appear with a large blue circle. This works equally well in the Overworld or on the Moon and any ore within 5 spaces should be indicated.
The glasses must be equipped in the helmet armor slot in your inventory. They may be toggled into two modes: Regular and Advanced (the specific key binding can be adjusted under Options... -> Controls... -> [GC] Toggle Sensor Goggles Mode).
If you are within five spaces of an ore, a blue square will appear on the screen. This will be shown in relation to the crosshair in the middle of the screen. If you move around until the square is directly over the crosshair you will be either directly above or below the ore.
If you toggle Advanced Mode, the ores indicated will now move in relation to the x- and y-axis, which may allow you to more easily find ores.