Yes you can use a relay. It is just an electromagnetic switch that switches when it is energized, instead of when you toggle it, or when you press the button. You can do all sorts of things with them. The wiring for a SPST relay can be found online and most likely on the back of the packaging...