American students once again lag behind many of their Asian and European peers on a global exam, a continuing trend that often is blamed on child poverty and a diverse population in U.S. schools.

Education Secretary Arne Duncan called the results a “picture of educational stagnation” as U.S. students showed little improvement over three years, failing to score in the top 20 on math, reading or science.

Students in Shanghai, China’s largest city, had the top scores in all subjects, and Singapore, South Korea, Japan and Hong Kong students weren’t far behind. Even Vietnam, which had its students participate for the first time, had a higher average score in math and science than the United States.

These results again raise the question of whether the United States is consistently outperformed because of the widely varied backgrounds of its students. Some are from low-income households, for example. Others don’t have English as their primary language.

But some countries that outperform the United States also experience such challenges.

“Americans have got a thousand reasons that one country after another is surpassing our achievement, and I have yet to find a good excuse,” said Marc Tucker, president of the National Center on Education and the Economy.

About half a million students in 65 nations and educational systems took part in the 2012 Program for International Student Assessment, or PISA, which is coordinated by the Paris-based Organization for Economic Cooperation and Development, or OECD.

Most results come from a sampling of scores from countries as a whole, but in China it was given in select regions, and the results in the financial hub of Shanghai, one of the country’s richest cities, are by no means representative of China’s overall education level.

Shanghai’s per-student funding at the middle-school level is nearly four times the national average, and prosperous Shanghai families spend thousands of dollars more per year for tutoring.

The Education Department’s National Center for Education Statistics released the results. The test, given every three years to 15-year-olds, is designed to assess students’ problem-solving skills.

U.S. scores on the PISA haven’t changed much since testing started in 2000, even as students in countries like Ireland and Poland have shown improvement and surpassed U.S. students.

Irish Education Minister Ruairi Quinn said the results reflected improvements among Ireland’s lower-achieving students, even as the country’s top students underperformed compared to those in other countries.

In Britain, scores were about the same as three years ago, prompting debate about why the country has not improved despite increased spending on education. The nation did better than the United States in math and science but was not among the top performers in any subject.

“Since the 1990s, our performance in these league tables has been at best stagnant, at worst declining,” said Britain’s Education Secretary Michael Gove, adding that the results “underline the urgent need for our reforms.”

Gove’s ruling Conservative Party and the opposition Labour Party both blamed each other’s policies for the results.

Meanwhile a business organization said Britain has fallen behind in part because of “historic complacency” and a lack of focus on achievements and results compared to Asian countries.

“Countries with an unrelenting focus on the quality and rigor of their education system will be the ones who win,” said Mike Harris at the Institute of Directors.

Duncan, too, called for an increased focus on education.

“We must invest in early education, raise academic standards, make college affordable and do more to recruit and retain top-notch educators,” he said.

Tom Loveless, a senior fellow at the Brookings Institution, cautions about reading too much into the results from Shanghai, which also dominated the test in 2009. The students tested are children of the elite. They are the ones allowed to attend municipal schools because of restrictions such as those that keep many migrant children out, he said.

“The Shanghai scores frankly to me are difficult to interpret,” Loveless said. “They are almost meaningless.”

But Jack Buckley, commissioner of the National Center for Education Statistics, said U.S. officials have not seen any evidence of a “biased sample” of students tested in Shanghai. If the entire nation was included, he said it’s unclear what the results would show.

Tucker said Shanghai has worked hard to bring migrant children into its schools and has put an emphasis on improving teacher quality — a factor helping to drive its test scores.

In the education community, Finland has drawn notice for its past test performance, but this year its average PISA score dropped in all three subjects, most pronounced in math. Finland’s students did better on average than those from the United States.

Overall, National Education Association President Dennis Van Roekel said among the Asian nations dominating the test, “The one thing they all have in common is that they make a real commitment to education for all kids, and nothing deters them from that vision, and then they do what’s necessary to make that happen. In the United States, we don’t have the commitment for all kids and it needs to change.”

One indicator of performance is how many students hit a high benchmark on each subject tested. In the United States, 9 percent of test-takers hit that mark in math, 7 percent did so in science and 8 percent did in reading. Fewer U.S. test-takers hit that mark in math than the international average. However, they performed at about the international average in the other two subjects.

The test is based on a 1,000-point scale. Among the findings:

— In math, the U.S. average score was 481. Average scores ranged from 368 in Peru to 613 in Shanghai. The international average was 494.

— In science, the U.S. average score was 497. Average scores ranged from 373 in Peru to 580 in Shanghai. The international average was 501.

— In reading, the U.S. average score was 498. Average scores ranged from 384 in Peru to 570 in Shanghai. The international average was 496.

Students from all states were tested. But for the first time, three states, Massachusetts, Connecticut and Florida, opted to increase participation in PISA to get more state specific results.

Average scores from Massachusetts were above the international average in all three subject areas. Connecticut’s scored on average around the international average in math and higher than the international average in science and reading. Florida students on average scored below the international average in math and science and around the international average in reading.