This paper deals with two speed optimization problems for ships that sail in and out of Emission Control Areas (ECAs) with strict limits on sulfur emissions. For ships crossing in and out of ECAs, such as deep-sea vessels, one of the common options for complying with these limits is to burn heavy fuel oil (HFO) outside the ECA and switch to low-sulfur fuel such as marine gas oil (MGO) inside the ECA. As the prices of these two fuels are generally very different, so may be the speeds that the ship will sail at outside and inside the ECA. The first optimization problem examined by the paper considers an extension of the model of Ronen (1982) in which ship speeds both inside and outside the ECA are optimized. The second problem is called the ECA refraction problem, due to its conceptual similarity with the refraction problem when light travels across two different media, and also involves optimizing the point at which the ship crosses the ECA boundary. In both cases the objective of the problem is to maximize daily profit. In addition to mathematical formulations, examples and sensitivity analyses are presented for both problems.