New Jersey is nearly the best state in the country for child well-being, according to an analysis from a national foundation devoted to developing a brighter future for children.

The Garden State ranks third — behind only New Hampshire and Massachusetts — in the State Trends in Child Well-Being report released Wednesday by the Annie E. Casey Foundation.

The report looked at more than a dozen measures across four broader categories to gauge a child's chances for success.

New Jersey ranks in the top half of states in all four categories: economic well being; education; health; and family and community indicators.

Its best showing comes in the education category, ranking No. 1 in the nation. The state posts the lowest percentage of 3- and 4-year-olds not in school, using 2014-16 data, and ranks second-best for high school students graduating on time, using 2015-16 data. The state also ranks second-best for reading proficiency in fourth grade and math proficiency in eighth grade, using 2017 numbers.

New Jersey ranks third out of the 50 states in the health category.

"New Jersey does relatively well on low birth-weight babies, but also does, compared to national data, very well on child and teen deaths per 100,000," Patrick McCarthy, president and CEO of the Annie E. Casey Foundation, told New Jersey 101.5.

Just 4 percent of New Jersey children went without health insurance in 2016, according to the report.

With 31 percent of children living in single-parent families, and 10 percent of children in families where the head of household lacks a high school diploma, the Garden State ranks 15th in the category of family and community. The state, though, does post one of the lowest teen birth rates.

The category of economic well-being gives New Jersey its worst performance in the report — 21st among the states. According to 2016 data, 15 percent of New Jersey children are living in poverty, and 39 percent are living in households with a high housing cost burden. Twenty-four percent of children in New Jersey have parents who lack secure employment.

The nation as a whole improved on most indicators since 2010, the report shows. The child poverty rate dipped from 22 percent to 19 percent, for example. The rate of children without health insurance was cut in half.

New Mexico ranks dead last for child-well being, followed by Louisiana and Mississippi.