Excessive CO2 emissions and increased total costs of liner shipping are the two main problems affecting the environmental and economic benefits of liner companies under the European Union Emission Trading System (EU ETS). To address the upcoming EU ETS, we propose a carbon and cost accounting model for liner shipping that accurately calculates CO2 emissions and total cost of liner shipping. We conduct a case study that a containership operates on the liner route from the Far East to Northwest Europe. The results show that the sailing stage plays a pivotal role in CO2 emissions from liner shipping, accounting for 94.70% of CO2 emissions. Among four types of fuel, CO2 emissions from liner shipping using MGO is the largest, while CO2 emissions from liner shipping using methanol is the smallest. Methanol, as an alternative fuel, proves to be a better choice than LNG for CO2 control of liner shipping. The relationship between sailing speed and CO2 emissions follows a U-shaped curve for the selected containership. Notably, speed reduction is effective in carbon control of liner shipping only when the sailing speed exceeds 8.29 knots. Under the EU ETS, sailing speed is a key variable affecting the total cost of liner shipping. Speed reduction may not always be cost-effective. When keeping the total cost of liner shipping unchanged, sailing speed should be reduced as the EU allowance (EUA) price rises within a certain range. For the selected containership using MGO and HFO, the most economical sailing speed is 8.29 knots, corresponding to the increase in EUA price of 304.95% and 261.21%, respectively. If EUA price continues to rise, speed reduction will become ineffective in controlling the total cost of liner shipping. This model can enhance the environmental and economic benefits of liner companies, meet compliance requirements of the EU ETS, and provide a new perspective for carbon and cost control of liner shipping.