Vibrating motors at digital output affecting analog input

I have a set of EMG sensors connected to two analog inputs on my UNO. When the UNO determines there isn't a contraction, I set a digital pin to HIGH which goes to two vibrating motors (a BJT is used as a switch and a battery supplies current to the motors). When the motors turn on, the inputs spike. Any ideas on why this happens and how to fix it?

Have you kept the motor currents away from the Arduino (ie no high current path through the ground connections to the Arduino board)? Potentials can be created in the ground wiring due to current spikes, causing the reference for the analog circuitry to change.

Is the motor circuit close to the analog input circuit? Are the analog signals properly screened (shielded cable or twisted-pair)? Induced EMFs might be generated in the sensitive analog circuitry if close to the magnetic field created by the motor currents. Also sparking on the motor commutator can create radio-frequency interference.

Actually I've just twigged what EMG stands for - those sensors are very sensitive to stray fields and you need to keep all the power electronics well away from them. Screen every cable perhaps?

A spike when the motors are turned on is hard to avoid. I can add to MarkT comments: Are the capacitors of the power supply large enough ?

I have some vibrating motors, they shotcut with spikes. I opened one, but can't tell why they do that. It turned out that with low voltage and low speed they shortcut now and then. Only at 12V (full speed) they don't.

Motor's are dirty beasts, have you tried and X2Y filter?

There's advice on electromagnetic compatibility and reducing electromagnetic interference here: