The Erchius Horror is defeating by activating the mining laser below it three times. The laser must first be powered up by triggering all four switches found around the boss, two to each side of the Horror itself. The Horror will also summon moontants that will attack the player when on the bottom platform.
Using a shield is an excellent tactic for defeating the Erchius Horror. Performing a "perfect block", i.e. using the shield immediately so that it flashes when you are about to be hit by a laser, will mitigate all damage that the beam would otherwise cause.
Another tactic is to use a two-handed sword to parry the laser beam. This will also prevent all damage.
One tactic that was mentioned in the Starbound forums was to equip a shield in each of the L and R slots, to hold down the left mouse button, and then to rapidly press Z to switch between the two shields. This has the effect of persistently performing a perfect block since the shield will immediately be used once it switches into place. And since the moontants remain on the lower platform they will only be an issue when activating the laser.
As for the invisible lasers, this is (as of today, February 13, 2015) a known bug in the Stable build; this has been fixed in the Unstable build.