There is a connection between specialization and trade. In an ideal economic world free of trade barriers, countries should make the products that they can make more efficiently than countries. Then each country will trade its products for the products that the other countries can make more efficiently than them. Specializing in certain products and trading for others allows for the most efficient use of resources.
For example, if the United States can grow corn more efficiently than other countries, we should grow corn and trade it for a product that we have trouble making. If Panama can grow bananas more efficiently than we can but can't produce corn, then the United States could trade its corn for Panama’s bananas. By specializing in certain products and trading for others, countries can capitalize on the resources they already have to get products they can’t make as readily.