Yes, a relay would do.
How much current is flowing? If it's very low, you need a relay with gold plated contacts.
Do you have both positive and negative DC power supplies?
If it's very low current and you have a bipolar power supply, then an analogue switch would do. It's just an IC with small MOSFETs connected in reverse parallel, to switch the current and some level shifting to control the gates.