It's more about the technique than the bike. If you're riding slippery, technical trails with lots of roots and rocks (like here in Missouri!) first be sure you have good rubber. A good gnarly knobby will work wonders compared to the usual do-everything tires that come with most bikes.
Stopping wheelspin on uphills is a delicate balance. You have to keep your weight back enough to keep traction, and forward enough so as not to wheelie. (no steering with your front wheel in the air!)
On loose stuff, the usual technique is to grab those bar-ends (that's what they're for) and coordinate a sharp pull-back on the bars with each power stroke. That drives the rear wheel into the ground.
This is something that takes practice, but you can do it on pavement. It's a rapid, rythmic pulling in time with your pedal strokes.