How to control the speed of a 12V DC motor with an Arduino?
Your diode is in the wrong position- it should be across the motor (blocking!) not across the transistor. 

The purpose of the diode is to allow current that is flowing in the motor coil to continue to flow in the same direction when the transistor turns off. When the transistor turns off, the voltage at the transistor collector will rise as it was flowing out of the motor. From \$V_{CE(SAT)}\$ it will rise above the power supply voltage and stop only when the transistor breaks down (or when it starts to ring with parasitic capacitance). By putting a diode from the transistor collector to the +12V rail, you prevent the voltage across the transistor from exceeding 12V and and allow the motor current to continue to flow. 

The way you have the diode in your pictorial, it would only conduct were the voltage to go below ground. That could only happen if someone mechanically spun the motor very fast in the reverse direction (and your diode would cause the voltage on the 12V rail to increase as a result).