A comparative advantage is defined as the ability of a country/firm to produce goods and services at a lower opportunity cost than its competitors or other trade partners. This involves producing at a lower marginal cost.
Comparative advatanges emerge due to the differences in labor productivity existing between those two countries. The countries which enjoy a larger productivity can produce larger outputs by using the same amount of resources in comparison with their less productive partners.