According to the Congressional Research Service, most economists agree that trade barriers like tariffs or import quotas are counterproductive or harmful over the long run. In certain circumstances, however, there might be advantages to trade barriers---or at least arguments made in favour of trade restrictions---particularly in times of instability or when a country has a vested interest in preserving domestic industries.
Increased National Security
One advantage to trade restrictions is that it can encourage economic independence---a policy known as "autarky." For example, a country that is dependent on hostile neighbours for critical natural resources might attempt to secure a stable domestic supply, so that they are not beholden to other countries for their defence. If a country isn't self-sufficient, trade embargoes can be used as a weapon against them.
Protection of Growing Industries
Another advantage of trade barriers is that they can help protect the development of new industries against foreign competitors. For instance, a country that is heavily dependent on exporting crude oil, and recognising that oil is not a renewable resource, might wish to expand into consumer electronics. Without trade restrictions, their domestic electronics industry might be crushed by competition from abroad; trade barriers can help keep the industry safe until it can compete on its own.
Protection Against Other Countries
Trade barriers can also protect a country against other, predatory nations. "Dumping" occurs when one nation sells large amounts of its product in another country below cost, allowing them to starve out possible competition. For example, if a lumber-exporting country wishes to establish a monopoly in another nation, they may "dump" their exports on that country until its lumber companies can no longer afford to compete. In these cases, trade barriers in the form of import quotas or tariffs can limit the ability of another country to "dump" its industry, preserving domestic competitors against those with an unfair advantage.
Promotion of Domestic Jobs
The most frequently cited advantage of trade barriers is that they help to promote domestic employment by keeping companies from "offshoring," or transferring domestic jobs abroad. Overall, according to the Federal Reserve Bank of San Francisco, economists believe that offshoring does not result in a net loss of domestic jobs, but rather, that jobs lost in certain sectors are recovered in others; however, this argument is nevertheless commonly used in support of trade barriers or restrictions. These trade barriers do help to preserve current employment, which can be seen as a key advantage. On the other hand, by limiting the competitive advantage of a country, they may also decrease opportunities for future employment.