Energy weapons have one important advantage over projectile weapons - they can be fired in zero gee, due to their lack of significant recoil (at hand weapon power levels it's infinitesimal). As Newton's Third Law of Motion points out, for every action there is an equal but opposite reaction. As anyone who has fired a weapon knows, they kick back with recoil. Imagine that happening in the weightless environment of space, with nothing to brace yourself against. A beam (or particle weapon) does not have that liability, and while you are struggling to draw down on Spock, he'll pull that dinky little Type I Phaser out from under his shirt and cook your ass as easily as you can wield a laser pointer.

If a Starship had to carry physical guns firing slugs of any material, they would not only have a serious weight penalty over a beam-weaponed ship, it would have ammunition concerns as well as having to deal with recoil compensation when navigating during a battle.

In addition, energy weapons can be operated by anyone, giving anyone able to point their arm and press a button (I'd hate to see what a vicious 5-year old with a phaser could do) the ability to deliver the energy equivalent of an 20-century infantry platoon's firepower at an enemy.

This power-to-weight ratio of beam weapons is the primary reason they trump projectile weapons. Imagine having somthing as small and as powerful as a Star Trek Type 1 Phaser today? You could keep it in your hip pocket, yet be able to whack a hundred people at a whim.

In the Star Trek episode "Omega Glory" (written by Gene Roddenberry,directed by Vince McVeety, and first aired in the second season on March 1st, 1968), Captain Tracy (played by Morgan Woodward) and a handful of locals fought a pitched battle with phasers against hand weapons, killing thousands of their enemy before being overrun. Tracy even managed to get out of the slaughter alive. (You know he kept most of the energy packs for himself.)

Efficiency is also a factor. A beam weapon can be charged using any energy source, and vice versa, making them especially useful as both a weapon and power store. Scotty demonstrated this in the original series episode "Gallileo 7" (first season, story by Oliver Crawford, directed by Robert Gist, first aired January 5, 1967), where he drained most of the group's phasers to charge their shuttle's (the episode's namesake) energy supply with enough juice to allow the stranded team to take off.

The list of additional applications of an energy weapon range from lighting fires, heating stones to warm yourself when no wood is available to set fire to, stunning your enemies instead of killing them, and having the ability to set it so that it overloads, creating an explosive device of devastating power for its size.

In a future space-based society, energy will be abundant, but raw material will be relatively dear. If you threw mass overboard with every battle, you'd have to get more from somewhere. A ship using energy weapons simply recharges the batteries.

Shro0m points out the advantage energy weapons have in the lack of drift in long distance applications while in atmosphere. A laser rifle with great optics would make a superior sniper's weapon, able to take out a target with no concern for range, windage, motion of the target (who can outrun a laser?) or recoil.

On rate of fire, the slow fire rate was only seen in the original series. In Star Trek II, the ships shoot the living shinola out of one another using phasers with high fire rates.

More thanks to The Star Trek Concordance by Bjo Trimble. I bought it when I was 15, and have managed to keep my hands on it these last 28 years.