As the debate on streaming and setting continues, the study from King's College, London shows that a child's position within the year group has a much greater influence on results.
Professor Dylan Wiliam, one of Britain's leading assessment experts, found that secondary pupils placed in the top maths set score up to three grades higher at GCSE than they would have done if placed in the bottom set.
Professor Wiliam concludes that setting may harm pupils from disadvantaged backgrounds, who are over-represented in bottom sets, and that ministers should give parents a choice of schools to include those which do not set.
While the Prime Minister and, to a lesser extent, the First Minister in Scotland have extolled the virtues of setting or grouping by subject ability, Professor Wiliam warns: "By presuming that setting should be the norm in secondary schools (in England), the Government is denying parents the choice that really matters - being able to send one's children to a school that does not set for mathematics."
The policy in Scotland, and the basis on which school inspections are carried out, is that setting should simply be one of a number of arrangements available to schools - the key test, as it is for flexibility in the curriculum, is whether there are likely to be benefits for the pupils.
Professor Wiliam and Hannah Bartholomew analysed the results of 995 teenagers in six London schools, comparing their GCSE maths grades in 2000 with their 1998 key stage 3 (KS3) scores. They found dramatic differences in progress made by pupils of similar ability according to the set in which they are placed.
On average across the six schools - all of which set for maths - pupils in the top set achieved half a grade better at GCSE than would have been expected given their performance at KS3, on a "value-added" measure. Those in the bottom set scored half a grade worse than was suggested by their KS3 results, while those in intermediate sets were between these two extremes.
In one school, the differences were even more striking: top-set pupils achieved 1.4 grades higher than expected at GCSE, while the bottom set's results were 1.5 grades worse than expected.
By contrast, when comparing results overall across the six schools, there was little difference in the "value-added" scores.
The best school on this measure saw pupils achieving 0.28 of a GCSE grade better than their KS3 results suggested, while the worst missed by 0.27.
Critics might suggest, the study says, that the findings could be explained by the fact that schools tended to bias higher sets in favour of pupils who wanted to learn, even if they had not done well at KS3.
However, it says the figures did not support this argument. Previous research has suggested that lower-set teachers were less well-qualified and had lower expectations of pupils.
In April, a separate study from London university's institute of education found that pupils who were placed in the wrong set could underachieve in GCSE.
It found that in maths, the structure of some GCSE exam papers, which deny some pupils the chance of a grade C, meant bottom-set pupils were less likely to score well, whatever their ability.