Speed is the stat in game that decides who gets to fire first. The mechanics that decide speed are outlined below.
Speed is affected by:
Ship Class - Each class is assigned a base speed that can be viewed in the shipyard.
Speed Skill - Each level of skill increases speed by 3.
Speed Tech - Each level of tech increases speed by 1.
Nitemare - The pillar provides a 10% speed bonus.
Speed Buff - The buff can be used to provide a 10% speed bonus.
Therefore the formula for speed is as follows:
Effective Speed = ((Base Speed + 3*Speed Skill Level + Speed Tech)*Nitemare Buff (Value = 1.1)*Speed Buff (Value = 1.1))
More on SpeedEdit
Buffs stack in a multiplicative fashion, therefore should one have both Nitemare and the Buff active, speed is increased by 21%.
Should there be a tie, first shot goes to the fleet with a higher command stat.
In the event that a tie occurs and command stats are equal, it appears that the attacker gets the first shot as seen when one attacks their own phantom.