It's basically fatigue. You've burned up the stored energy in your muscles, and they spasm because they are only partly-fuelled, it messes up the motor neurons - the nerves that tell the muscles to contract.
Have a carbohydrate-heavy meal before the workout, or carb drink during it, this will give your body more fuel. Do a proper cool down after a workout, 5-10 minutes of light lifting or going for a walk, this will promote circulation to the depleted muscles, redistributing your energy stores. Both these things will prevent shaking.
The shaking is harmless, but having the carbs and cooldown will help recovery, leaving more energy to build muscles and making you less sore tomorrow.