If you need variable speed in both directions, you can buy an H Bridge Chip, or build an H Bridge Circuit. Below is a simple schematic showing transistors, but there is no reason you can't replace with MOSFETS, switches, or relays. To turn the motor in one direction, you can saturate A and D. To turn in the other direction, you saturate B and C. If you only need one direction you can omit B and C and replace A with a short.
You can send a PWM signal to D or C to control the speed, but if you do you can't use relays for D and C.
The resistors limit base current, the diodes protect against over voltage due to the motor inductance, and the capacitor (often 1 uF) reduces brush noise.
The transistors need to be able to supply enough current to the motor. If you can stall the motor and drive it for a second without smoking the transistors you did ok.