SHANGHAI  In Li Zhen’s ninth-grade mathematics class here last week, the morning drill was geometry. Students at the middle school affiliated with Jing’An Teachers’ College were asked to explain the relative size of geometric shapes by using Euclid’s theorem of parallelograms.

“Who in this class can tell me how to demonstrate two lines are parallel without using a proportional segment?” Ms. Li called out to about 40 students seated in a cramped classroom.

One by one, a series of students at this medium-size public school raised their hands. When Ms. Li called on them, they each stood politely by their desks and usually answered correctly. They returned to their seats only when she told them to sit down.

Educators say this disciplined approach helps explain the announcement this month that 5,100 15-year-olds in Shanghai outperformed students from about 65 countries on an international standardized test that measured math, science and reading competency.