The all-electric ship (AES) offers new hope for the reduction of fuel consumption and carbon emissions. To fully exploit the photovoltaics (PVs) installed on the AES, the two-axis solar tracker is proposed to find the best tilt and surface azimuth angles of PV panels. The tilt angle is computed by particle swarm optimization (PSO) regarding the time and ship location. The surface azimuth angle is adjusted according to the hemisphere. The dynamic performance of the proposed solar tracker is evaluated using MATLAB/Simulink simulation. According to the simulation results, the proposed solar tracker can obtain maximum energy all day, while the voyage time, fuel consumption, and carbon emissions are significantly reduced. Moreover, the proposed solar tracker can effectively operate under communication delay caused by the global positioning system (GPS).