For positive beetle identification, the key is the pattern of the galleries. Each kind of beetle makes a unique gallery pattern.
Haven't dealt with spruce beetles, but for beetle damage prevention in general, the best tactic is to keep tree densities down so the trees remain vigorous. Healthy trees can often drown a few attacking beetles in sap and survive. You can sometimes find these beetles in the pitch that has been expelled. Lots of beetles can overwhelm any tree, regardless of how healthy. Unfortunately, it is usually too late to make a stand healthy after a beetle attack has started--the trees don't get vigorous fast enough.