Comparing the quality of governance between states can be challenging. The decisions state governors, legislators, city mayors and other elected officials make can have wide-reaching effects on state residents, and these decisions can sometimes take years to have an impact.

Aware of these inherent challenges, 24/7 Wall St. has for seven straight years reviewed the outcomes and conditions of every state in the country, ranking each based on finances as well as social and economic indicators. This year, for the fifth year in a row, North Dakota ranks as the best run state in the country. For the second consecutive year, New Mexico ranks worst.

17. Massachusetts

> Debt per capita: $10,926 (the highest)
> 2015 Unemployment rate: 5.0% (tied-23rd lowest)
> Credit rating: Aa1/AA+
> Poverty: 11.5% (tied-13th lowest)

With a wealthy tax base and substantial tax revenue, Massachusetts regularly reports some of the best health and education outcomes of all states. The state spends $15,087 on education per student, about $4,000 more than the national average. An estimated 90.2% of adults have at least a high school diploma, well above the national rate, and 41.5% have at least a bachelor’s degree, the highest of all states. Additionally, just 2.8% of Massachusetts residents do not have health insurance, the lowest uninsured rate in the country.

Heavy spending, however, has saddled the state with debt. State debt is equal to $10,926 per resident, more than three times the average across all states. At the end of last year, Massachusetts was on track to hit its $21.7 billion debt ceiling in the 2017 fiscal year. Citing possible financial instability resulting from the state’s heavy borrowing, S&P recently downgraded its outlook on Massachusetts from stable to negative.

There is no comprehensive measure of how well or poorly a government runs a state. Our basis for this ranking consists of measures of financial health and fiscal responsibility, as well as socioeconomic outcomes such as unemployment, poverty, and crime — conditions state governments are tasked with managing and improving.

Selecting appropriate criteria to compare 50 states is difficult because governing does not occur in a vacuum. Each state has different populations, obstacles, and means with which to work. Some states are more rural, while others are highly urbanized and densely populated. Some states depend disproportionately on one industry, while economies in other states are more diverse. Some states rely on high-skilled sectors, such as technology and business services, while others are rich in natural resources.

These circumstances can have a meaningful impact on where they rank in our list. North Dakota’s economy, for example, experienced a boom a few years back due to the explosive development of the Bakken shale oil formation. The consequent population and employment growth helped result in extremely low poverty and unemployment rates, and helped propel the state higher in the rankings.

The very resources that help some states can become a burden to those that are overdependent on them. The massive decline in global oil prices from the second half of 2014 through 2015 has taken a serious toll on state oil revenues. Should prices persist at these low levels, the socioeconomic benefits from the oil boom in these states may soon evaporate.

While some states’ economic fortunes are closely tied to the rise and fall of individual industries, which are often outside of the government’s control, each state must make the best of its own situation. Governments, as stewards of their own economies, need to prepare for the worst, including the collapse of a vital industry. Good governance is about balancing tax collection and state expenditure in a way that provides essential services to residents without sacrificing a state’s long-term fiscal health. Setting aside a rainy day fund and not incurring too much debt, for example, are ways to plan for the worst.

For a majority of states, the bulk of government revenue comes from taxes. To ensure a healthy tax base, states can create grants, subsidies, and incentives to encourage the growth of businesses in the region. Some of the best run states on our list have a high share of workers in professional, scientific, and financial jobs, which tend to be higher-paying.

The best run states also have growing populations, with many new residents likely attracted by educational and occupational opportunities. The best run states often attract the wealthiest, most educated residents, and, with the resulting tax revenue, can continue to promote smart economic development.

Rank State Debt per capita Unemployment rate Credit rating Poverty rate
10 Oregon $3,620 5.7% Aa1/AA+ 15.4%
9 Washington $4,407 5.7% Aa1/AA+ 12.2%
8 Colorado $3,103 3.9% Aa1/AA 11.5%
7 Texas $1,524 4.5% Aaa/AAA 15.9%
6 Iowa $2,031 3.7% Aaa/AAA 12.2%
5 Utah $2,446 3.5% Aaa/AAA 11.3%
4 Wyoming $1,586 4.2% No GO debt/AAA 11.1%
3 Nebraska $1,007 3.0% No GO debt/AAA 12.6%
2 Minnesota $2,882 3.7% Aa1/AA+ 10.2%
1 North Dakota $2,493 2.7% Aa1/AA+ 11.0%

Click here to see the best and worst run states in America: a survey of all 50.