Controlling a relay with a transistor switch

Your relay will work, assuming that a) it is rated for 5v drive, and b) you have a free-wheeling diode on the relay; and c) your transistor is rated as such.

You may also consider a solid state switch for high frequencies or life.