Is analogWrite() inferior to writing directly into registers? I'm trying to control a DC motor's speed with my Arduino Mega analogWrite(), but it doesn't seem to function properly. The motor never completely slows down, just slows down a bit (which is still pretty fast) and then stops spinning completely.

I'm trying to create a robot with different speeds, and it just has to have a slow speed. I know it isn't the code, since the relay and motor works just fine when I use the digitalWrite().

Is it better to write directly into the timer registers to implement the PWM, OR what else could be causing the problem?
analogWrite() is already PWM, Arduino doesn't produce a true analog signal
Motors tend to draw a lot of current so you might want to control the motor with a MOSFET then connect your power supply directly to the motor. PWM will still work in that case, you just need to connect the output pin to the gate pin of the MOSFET
If you want more of an assurance when working with motors, try buying a motor shield. You current problem, speed problem and many will be resolved. It also makes it easy to control multiple motors.