One of the first experiments I did with my Arduino Uno was to try to drive a motor. I followed the instructions at https://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors to run a very simple DC motor using the PWM output pins on the Arduino.
The Adafruit lesson suggests a PN2222 transistor, but I used a 2N3904 transistor, which is also a NPN type transistor. My understanding is that the primary difference between them is the amount of current that they can handle, the PN2222 being able to support more current. The datasheet says that the 2N3904 has a maximum collector current (IC) of 200 mA, which should be sufficient to drive a small DC motor.
The diode is a very important part of the circuit and protects your Arduino from currents coming from the inductive load of the motor.
I used the code from the sketch on the Adafruit site. This reads a value from the serial input and uses that to set the level on a PWM (pulse width modulation) output pin. I'll talk more about PWM later.
It was interesting to see how different values were able to run the motor at different speeds. For fun, I hooked this circuit up to a Rigol DS1054Z Oscilloscope to see the signals at the PWM output and also across the motor itself.