FILE - Portsmouth, New Hampshire

Portsmouth, New Hampshire, on the Piscataqua River.

New Hampshire ranked in the middle of CNBC’s listing of “America’s Top States for Business,” but several subcategories showed why it is attractive to large and small businesses alike.

Despite its relatively small size, the state placed 25th overall for criteria that include inclusivity, workforce quality and overall quality of life. The last, as businesses across the country are discovering, is critical in attracting a younger workforce, according to CNBC, which has conducted the study for the past 12 years.

It is in quality of workforce and quality of life that New Hampshire shined the most. The Granite State has one of the most educated workforces in the country, according to CNBC's analysis.

CNBC rated New Hampshire in 10th place for both the percentage of its workforce with college degrees and the percentage that work in STEM (science, technology, engineering and mathematics) professions. The quality of the overall workforce in the state boosted it to eighth place; last year it was 19th.

It placed fifth overall in quality-of-life issues such as low rates of violent crime (the third lowest in the nation) quality of the environment. The lowest child-poverty rate in the nation and a high rate of inclusivity also contribute to making the state attractive to businesses and workers.

Statistics cited by CNBC included the 1.7 percent growth of the state’s gross national product in the fourth quarter of 2018; a low unemployment rate (2.4 percent as of May); a low corporate tax rate in giving New Hampshire the top spot for business friendliness.

In a press release regarding the rankings, Commissioner Taylor Caswell of the Department of Business and Economic Affairs, said, “New Hampshire has a modern economy with significant growth in advanced and emerging industries that is supported by a defined and highly aligned pipeline of talent.”

CNBC explained its criteria for ranking state data as:

“Every year since 2007, CNBC’s exclusive study has ranked all 50 states based on their scores in ten categories of competitiveness. This year’s study subjects the states to 64 metrics across those categories. The tried and true methodology rates the states based on the attributes that matter most to business. To do that, we scour every state’s economic development marketing materials to see what they are pitching to business. The more frequently a selling point appears, the more weight it carries in the study.”