Few middle-income countries have successfully transitioned into advanced economies in the past twenty years. As the world struggles with a new economic slowdown, middle-income countries should look at the lessons from the economies that successfully made the jump.

The more successful countries in the bunch—particularly Finland and South Korea—set themselves apart from the rest by investing early in improving the quality of education and inducing high investment in research and development. By opening up to world trade and using tax incentives and access to subsidized credit, successful countries were able to attract foreign direct investment in high-technology sectors. And to allow for continued growth, Finland and South Korea were able to turn financial crises into opportunities to undertake much-needed economic reforms—this was only possible because there were broad political and social agreements on the essential elements for sustaining high growth rates.

But not every newly developed economy enjoyed this level of success, notably Spain, Portugal, and Ireland. Domestic demand led to phases of high growth, but these weren’t accompanied by countercyclical fiscal and monetary policies and effective regulation of the financial sector. Inevitably, high inflation, loss of competitiveness, and slow or negative growth ensued. The situations were made worse by fixed exchange rate regimes like the euro area, rigid labor markets, and a lack of competition in key markets, such as utilities and banking.

With these experiences in mind, there are four lessons that middle-income countries should learn to increase the probability that they will break through the so-called middle-income trap and successfully maintain strong economic growth rates.

Good macroeconomic management during crises is not enough.

Developing economies generally had adequate macroeconomic management during the recent global financial crisis, but this does not guarantee a successful transition toward sustained high growth. In fact, there are some early warning signs of imbalances generated by excessive capital inflows, low interest rates, and excess liquidity. These are creating consumption and construction booms in middle-income economies.

To prevent the outbreak of a new crisis, developing countries need to guarantee stable prices and growth not only through countercyclical fiscal and monetary policies, but also countercyclical management of the capital account, regulating financial sector borrowing and lending, and implementing external capital controls when required.

Rigid exchange rates and labor markets make it hard to maintain competitiveness.

Fixed exchange rates make it much more difficult to adjust to external or domestic shocks. Devaluation is not an available option and all adjustments must be made by cutting real salaries, reducing public and private spending, or raising taxes.

But flexible rates are not sufficient on their own. Unregulated capital inflows can easily turn countries into victims of their own success with excessive foreign borrowing by banks and the private sector, a significant appreciation of the currency, high inflation, and a loss of competitiveness. A more proactive role by governments and central banks may be necessary to intervene in the foreign exchange market, induce higher capital outflows in the form of sovereign saving funds abroad, and regulate or restrict capital inflows.

Less rigid and less segmented labor markets also allow for more swift economic adjustments that come with fewer negative impacts on employment. This requires reforms that change the types of work contracts and cut the cost of layoffs while increasing and improving unemployment insurance and other forms of social protection for both the formal and informal segments of the labor market.

Investments in education and innovation are essential for long-term growth.

The earlier middle-income countries increase the amount of public and private resources used to improve the quality of education, the greater the chance for a rapid transition into an advanced economy, a lesson clearly demonstrated by Finland, South Korea, and Ireland.

A similar effort to find the right institutional formula and incentives to diversify production and exports—going up the value chain through technological innovations—is clearly a challenge not yet met by most middle-income countries. This “trap” seems to be a reality for many middle-income economies.

Political and social agreements are critical to avoid stagnation.

External shocks or economic crises are impossible for any country to escape entirely, but the politics of crisis management are the key to what comes next—the two extremes being a protracted recession or a prompt resumption of high, sustainable economic growth. The capacity of political leaders to build consensus around a crisis management package and structural reforms needed for the post-crisis phase will determine the outcome.

Ireland in the late 1980s, Finland in the early 1990s, and South Korea after the Asian crisis showed that these agreements are possible and can be supported by policymakers, businesses, and labor alike. The absence of these bargains, however, explains the prevailing pessimistic outlook for the peripheral European economies.

The most productive thing middle-income countries can do to accelerate their transition to advanced economies is to establish a bipartisan political consensus for what’s needed to simultaneously solve the dilemmas of an economic crisis and ensure long-term economic growth.