There's a long thread on controlling a motor using GPIOs here:
viewtopic.php?f=66&t=15688You do have to be careful, because 5V can damage the RasPi BCM2835 SOC.
The simplest way to drive a 5V (or higher) DC motor is through an NPN transistor. Connect the GPIO through a resistor (start with 1K Ohm) to the base of the transistor and connect the emitter to ground. Connect the collector of the transistor to 5V (or whatever) through the motor. When you turn the GPIO on, it will run a small current through the transistor base-emitter junction, which will then run a 10-20X larger current through the collector, powering the motor.
When the motor turns off, a very bad thing will happen. Electrically, the motor is basically an inductor and you cannot stop the current through an inductor immediately. So when you try, the collapsing magnetic field causes a large voltage to accumulate at the transistor collector and quickly burn it out. If you're unlucky, the large voltage will also burn out your RasPi.
To prevent this from happening, you'll need a flyback diode (
http://en.wikipedia.org/wiki/Flyback_diode) across the motor.
Here's another discussion about driving a relay, which has a circuit diagram with transistor, resistor, and flyback diode:
viewtopic.php?f=37&t=22052 The discussion also talks about a Darlington pair, which you many need in place of a simple transistor.
The BCM2835 has a Pulse Width Modulation peripheral. You might be able to use that for variable speed.
One more caveat about GPIOs: the easiest way to destroy RasPi is to accidentally short one of the GPIO 5V pins to 3.3V. Be very careful not to do that -- if you're not using them, strip a short piece of insulation off a wire and insert it over the 5V pins.
I think this covers the most likely things that can go wrong. So enjoy!