Your pinion is toast. The spur on the other hand looks OK, but to be safe, I would replace it as well. If it has worn unnoticeably, it can transfer that wear to a new pinion. Odds are, just from looking at it, it is ok, but I would at least pull it and look it over very closely.
When installing the new gear(s), get some blue Loctite #242 or #243 and put a small drop on each screw holding the motor in. Do the same on the grub screw of the new pinion. I let that setup a bit before inserting the screws, but most people will install them right away. If you let it setup a bit, try not to get Loctite on the first couple threads of the screws because it will make it a tad hard to start them in the holes.
Get the motor screws snug, but JUST loose enough you can slide the motor. Line the pinion up with the spur gear and snug it down. Put a sheet of notebook paper in between the pinion and spur and slide the motor, pinching the paper between the gears. Tighten the motor screws, a little at a time until both are tight.
Once those are tight, tighten your grub screw in the pinion, making sure it is still aligned with the spur. Pull the paper out - you will likely have to rotate the gears to remove it. From there, you should notice ever so slightly a bit of slop in the gears when you rotate the spur back and forth. Just slightly noticeable.
Looking closer, your spur is toast too.
Also, look at the motor plate where the motor rocked back and forth for any gouges from the motor digging into the metal. Look for burrs, or raised metal. If it is bad, it will throw off the angle of the gear mesh and wear the gears prematurely.
Oh, the pinion is held on with a C-Clip on the end. Sorry, on my phone and hard to see everything.